Add showNewChangesNextTimeMBox in QtWidgets.py

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2024-05-28 11:47:47 +08:00
parent 6e61d7008b
commit 2e61910938
+19
View File
@@ -50,6 +50,7 @@ __all__ = [
'AppQToolBar',
'QuestionDeleteMBox',
'NewChangesNextTimeMBox',
'showNewChangesNextTimeMBox',
]
needTrans = functools.partial(needTransFn, source=__name__)
@@ -592,3 +593,21 @@ class NewChangesNextTimeMBox(AppQMessageBox):
self.setIcon(AppQMessageBox.Icon.Information)
self.setText(_('New changes will take effect next time'))
def showNewChangesNextTimeMBox(**kwargs):
try:
if APP().isSystemTrayConnected():
mbox = NewChangesNextTimeMBox(**kwargs)
if isinstance(mbox.parent(), QMainWindow):
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
else:
mbox.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
# Show the MessageBox asynchronously
mbox.open()
except Exception:
# Any non-exit exceptions
pass