From 2e61910938d49bf3f13ca18172efa46c68fcab7c Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Tue, 28 May 2024 11:47:47 +0800 Subject: [PATCH] Add showNewChangesNextTimeMBox in QtWidgets.py Signed-off-by: Loren Eteval --- Furious/QtFramework/QtWidgets.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Furious/QtFramework/QtWidgets.py b/Furious/QtFramework/QtWidgets.py index f19480b..5ab43f3 100644 --- a/Furious/QtFramework/QtWidgets.py +++ b/Furious/QtFramework/QtWidgets.py @@ -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