mirror of
https://github.com/283375/arcaea-offline-ocr-model.git
synced 2025-04-19 13:00:17 +00:00
feat: BlockLabelDialog
This commit is contained in:
parent
01b8b2e26c
commit
0ae960a405
38
ui/components/blockLabelDialog.py
Normal file
38
ui/components/blockLabelDialog.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
from PySide6.QtCore import Qt
|
||||||
|
from PySide6.QtWidgets import QApplication, QLabel
|
||||||
|
|
||||||
|
|
||||||
|
class BlockLabelDialog(QLabel):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
parent=None,
|
||||||
|
modality: Qt.WindowModality = Qt.WindowModality.ApplicationModal,
|
||||||
|
*,
|
||||||
|
autoShow: bool = False
|
||||||
|
):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
self.setWindowFlag(Qt.WindowType.Dialog, True)
|
||||||
|
self.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint, False)
|
||||||
|
self.setWindowFlag(Qt.WindowType.WindowMaximizeButtonHint, False)
|
||||||
|
self.setWindowFlag(Qt.WindowType.WindowCloseButtonHint, False)
|
||||||
|
self.setWindowModality(modality)
|
||||||
|
self.setWindowTitle("Please Wait")
|
||||||
|
self.setMinimumWidth(200)
|
||||||
|
self.setMargin(20)
|
||||||
|
self.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
|
|
||||||
|
self.autoShow = autoShow
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
super().show()
|
||||||
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
if self.autoShow:
|
||||||
|
self.show()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
self.close()
|
||||||
|
self.deleteLater()
|
@ -7,6 +7,7 @@ from PySide6.QtWidgets import QLabel, QWidget
|
|||||||
|
|
||||||
from project import Project
|
from project import Project
|
||||||
|
|
||||||
|
from .blockLabelDialog import BlockLabelDialog
|
||||||
from .projectEntry_Classify_ui import Ui_ProjectEntry_Classify
|
from .projectEntry_Classify_ui import Ui_ProjectEntry_Classify
|
||||||
|
|
||||||
|
|
||||||
@ -89,4 +90,8 @@ class ProjectEntry_Classify(Ui_ProjectEntry_Classify, QWidget):
|
|||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def on_loadSamplesButton_clicked(self):
|
def on_loadSamplesButton_clicked(self):
|
||||||
|
with BlockLabelDialog(self) as block:
|
||||||
|
block.setText(f"{self.project.name}<br>Loading unclassified samples")
|
||||||
|
block.show()
|
||||||
|
|
||||||
self.samplesListWidget.setSamples(self.project.samplesUnclassified)
|
self.samplesListWidget.setSamples(self.project.samplesUnclassified)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
from PySide6.QtCore import Qt, Signal, Slot
|
from PySide6.QtCore import Qt, Signal, Slot
|
||||||
from PySide6.QtWidgets import QApplication, QLabel, QWidget
|
from PySide6.QtWidgets import QApplication, QWidget
|
||||||
|
|
||||||
from project import Project
|
from project import Project
|
||||||
|
|
||||||
|
from .blockLabelDialog import BlockLabelDialog
|
||||||
from .projectEntry_Manage_ui import Ui_ProjectEntry_Manage
|
from .projectEntry_Manage_ui import Ui_ProjectEntry_Manage
|
||||||
from .yieldProgress import YieldProgress
|
from .yieldProgress import YieldProgress
|
||||||
|
|
||||||
@ -26,15 +27,10 @@ class ProjectEntry_Manage(Ui_ProjectEntry_Manage, QWidget):
|
|||||||
self.projectDescriptionLabel.setText("-")
|
self.projectDescriptionLabel.setText("-")
|
||||||
return
|
return
|
||||||
|
|
||||||
blockLabel = QLabel(self)
|
with BlockLabelDialog(self) as block:
|
||||||
blockLabel.setWindowModality(Qt.WindowModality.ApplicationModal)
|
block.setText(f"{self.project.name}<br>Updating status")
|
||||||
blockLabel.setWindowFlag(Qt.WindowType.Dialog, True)
|
block.show()
|
||||||
blockLabel.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint, False)
|
|
||||||
blockLabel.setWindowFlag(Qt.WindowType.WindowMaximizeButtonHint, False)
|
|
||||||
blockLabel.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
blockLabel.setText(f"Loading project<br>{self.project.name}")
|
|
||||||
blockLabel.setMargin(20)
|
|
||||||
blockLabel.show()
|
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
self.projectNameLabel.setText(self.project.name)
|
self.projectNameLabel.setText(self.project.name)
|
||||||
self.projectDescriptionLabel.setText(
|
self.projectDescriptionLabel.setText(
|
||||||
@ -49,8 +45,6 @@ class ProjectEntry_Manage(Ui_ProjectEntry_Manage, QWidget):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
blockLabel.close()
|
|
||||||
blockLabel.deleteLater()
|
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def on_updateButton_clicked(self):
|
def on_updateButton_clicked(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user