Update message box name

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2025-12-02 15:47:26 +08:00
parent 193d71c7f3
commit fbbbcad05f
11 changed files with 56 additions and 56 deletions
+2 -2
View File
@@ -158,7 +158,7 @@ class CoreManager(Mixins.CleanupOnExit):
if routing == 'Bypass Mainland China':
# TUN Mode handling
if not proxyModeOnly and SystemRuntime.isTUNMode():
showDirectRulesNotAllowedMBox()
showMBoxDirectRulesNotAllowed()
return None, False
@@ -228,7 +228,7 @@ class CoreManager(Mixins.CleanupOnExit):
if routing == 'Bypass Mainland China':
# TUN Mode handling
if not proxyModeOnly and SystemRuntime.isTUNMode():
showDirectRulesNotAllowedMBox()
showMBoxDirectRulesNotAllowed()
return None, False
+17 -17
View File
@@ -47,13 +47,13 @@ __all__ = [
'AppQTableWidget',
'AppQTabWidget',
'AppQToolBar',
'QuestionDeleteMBox',
'NewChangesNextTimeMBox',
'showNewChangesNextTimeMBox',
'DirectRulesNotAllowedMBox',
'showDirectRulesNotAllowedMBox',
'UnrecognizedConfigMBox',
'showUnrecognizedConfigMBox',
'MBoxQuestionDelete',
'MBoxNewChangesNextTime',
'MBoxDirectRulesNotAllowed',
'MBoxUnrecognizedConfig',
'showMBoxNewChangesNextTime',
'showMBoxDirectRulesNotAllowed',
'showMBoxUnrecognizedConfig',
]
@@ -610,7 +610,7 @@ class AppQToolBar(Mixins.QTranslatable, QToolBar):
self.setWindowTitle(_(self.windowTitle()))
class QuestionDeleteMBox(AppQMessageBox):
class MBoxQuestionDelete(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -637,7 +637,7 @@ class QuestionDeleteMBox(AppQMessageBox):
self.moveToCenter()
class NewChangesNextTimeMBox(AppQMessageBox):
class MBoxNewChangesNextTime(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -663,7 +663,7 @@ class NewChangesNextTimeMBox(AppQMessageBox):
self.moveToCenter()
def showNewChangesNextTimeMBox(**kwargs):
def showMBoxNewChangesNextTime(**kwargs):
@QtCore.Slot(int)
def handleResultCode(code):
@@ -677,7 +677,7 @@ def showNewChangesNextTimeMBox(**kwargs):
method = kwargs.pop('method', 'open')
if APP().isSystemTrayConnected():
mbox = NewChangesNextTimeMBox(**kwargs)
mbox = MBoxNewChangesNextTime(**kwargs)
if isinstance(mbox.parent(), QMainWindow):
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
@@ -697,7 +697,7 @@ def showNewChangesNextTimeMBox(**kwargs):
pass
class DirectRulesNotAllowedMBox(AppQMessageBox):
class MBoxDirectRulesNotAllowed(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -725,7 +725,7 @@ class DirectRulesNotAllowedMBox(AppQMessageBox):
self.moveToCenter()
def showDirectRulesNotAllowedMBox(**kwargs):
def showMBoxDirectRulesNotAllowed(**kwargs):
@QtCore.Slot(int)
def handleResultCode(code):
if code == PySide6Legacy.enumValueWrapper(AppQMessageBox.StandardButton.Yes):
@@ -735,7 +735,7 @@ def showDirectRulesNotAllowedMBox(**kwargs):
# Do nothing
pass
mbox = DirectRulesNotAllowedMBox(**kwargs)
mbox = MBoxDirectRulesNotAllowed(**kwargs)
mbox.finished.connect(handleResultCode)
if isinstance(mbox.parent(), QMainWindow):
@@ -747,7 +747,7 @@ def showDirectRulesNotAllowedMBox(**kwargs):
mbox.open()
class UnrecognizedConfigMBox(AppQMessageBox):
class MBoxUnrecognizedConfig(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -755,8 +755,8 @@ class UnrecognizedConfigMBox(AppQMessageBox):
self.setText(_('Unrecognized Configuration. Please modify it in the editor'))
def showUnrecognizedConfigMBox(**kwargs):
mbox = UnrecognizedConfigMBox(**kwargs)
def showMBoxUnrecognizedConfig(**kwargs):
mbox = MBoxUnrecognizedConfig(**kwargs)
if isinstance(mbox.parent(), QMainWindow):
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
+2 -2
View File
@@ -36,7 +36,7 @@ __all__ = ['UpdatesManager']
logger = logging.getLogger(__name__)
class QuestionUpdateMBox(AppQMessageBox):
class MBoxQuestionUpdate(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -116,7 +116,7 @@ class UpdatesManager(WebGETManager):
hasNewVersionCallback(newVersion)
if showMessageBox:
mbox = QuestionUpdateMBox(
mbox = MBoxQuestionUpdate(
parent=parent,
icon=AppQMessageBox.Icon.Information,
)
+12 -12
View File
@@ -35,8 +35,8 @@ __all__ = [
logger = logging.getLogger(__name__)
def showImportErrorMBox(clipboard: str):
mbox = ImportErrorMBox(icon=AppQMessageBox.Icon.Critical)
def showMBoxImportError(clipboard: str):
mbox = MBoxImportError(icon=AppQMessageBox.Icon.Critical)
if len(clipboard) > 1000:
# Limited
@@ -54,11 +54,11 @@ def importItemFromClipboard(clipboard: str):
factory = configFactoryFromAny(clipboard)
if not factory.isValid():
showImportErrorMBox(clipboard)
showMBoxImportError(clipboard)
else:
APP().mainWindow.appendNewItemByFactory(factory)
mbox = ImportSuccessMBox(icon=AppQMessageBox.Icon.Information)
mbox = MBoxImportSuccess(icon=AppQMessageBox.Icon.Information)
mbox.remark = factory.getExtras('remark')
mbox.setText(mbox.customText())
@@ -66,7 +66,7 @@ def importItemFromClipboard(clipboard: str):
mbox.open()
class ImportErrorMBox(AppQMessageBox):
class MBoxImportError(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -81,7 +81,7 @@ class ImportErrorMBox(AppQMessageBox):
self.moveToCenter()
class ImportMultiSuccessMBox(AppQMessageBox):
class MBoxImportMultiSuccess(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -120,7 +120,7 @@ class ImportMultiSuccessMBox(AppQMessageBox):
self.moveToCenter()
class ImportSuccessMBox(AppQMessageBox):
class MBoxImportSuccess(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -179,14 +179,14 @@ class ImportFromFileAction(AppQAction):
if factory.isValid():
APP().mainWindow.appendNewItemByFactory(factory)
mbox = ImportSuccessMBox(icon=AppQMessageBox.Icon.Information)
mbox = MBoxImportSuccess(icon=AppQMessageBox.Icon.Information)
mbox.remark = factory.getExtras('remark')
mbox.setText(mbox.customText())
# Show the MessageBox asynchronously
mbox.open()
else:
mbox = ImportErrorMBox(icon=AppQMessageBox.Icon.Critical)
mbox = MBoxImportError(icon=AppQMessageBox.Icon.Critical)
mbox.setText(_('Invalid data'))
mbox.setInformativeText('')
@@ -220,18 +220,18 @@ class ImportURIFromClipboardAction(AppQAction):
imported.append(factory.getExtras('remark'))
if len(imported) == 0:
showImportErrorMBox(clipboard)
showMBoxImportError(clipboard)
else:
if len(imported) == 1:
# Fall back to single
mbox = ImportSuccessMBox(icon=AppQMessageBox.Icon.Information)
mbox = MBoxImportSuccess(icon=AppQMessageBox.Icon.Information)
mbox.remark = imported[0]
mbox.setText(mbox.customText())
# Show the MessageBox asynchronously
mbox.open()
else:
mbox = ImportMultiSuccessMBox(icon=AppQMessageBox.Icon.Information)
mbox = MBoxImportMultiSuccess(icon=AppQMessageBox.Icon.Information)
mbox.imported = imported
mbox.rowCount = rowCount
mbox.setText(mbox.customText())
+2 -2
View File
@@ -65,7 +65,7 @@ class TUNModeAction(AppQAction):
else:
AppSettings.turnOFF('VPNMode')
showNewChangesNextTimeMBox()
showMBoxNewChangesNextTime()
class SettingsChildAction(AppQAction):
@@ -130,7 +130,7 @@ class SettingsChildAction(AppQAction):
else:
AppSettings.turnOFF('PowerSaveMode')
showNewChangesNextTimeMBox()
showMBoxNewChangesNextTime()
elif self.textCompare('Automatically Update Asset Files'):
if checked:
AppSettings.turnON_('AutoUpdateAssetFiles')
+1 -1
View File
@@ -255,7 +255,7 @@ class GuiTUNSettings(GuiEditorWidgetQDialog):
modified = self.inputToFactory(config)
if modified and SystemRuntime.isTUNMode():
showNewChangesNextTimeMBox()
showMBoxNewChangesNextTime()
self.accepted.disconnect()
self.rejected.disconnect()
+6 -6
View File
@@ -55,7 +55,7 @@ registerAppSettings('ServerWidgetSectionSizeTable')
registerAppSettings('UserServersHeaderViewState')
class UpdateSubsInfoMBox(AppQMessageBox):
class MBoxUpdateSubsInfo(AppQMessageBox):
def __init__(self, *args, **kwargs):
self.successArgs = kwargs.pop('successArgs', list())
self.failureArgs = kwargs.pop('failureArgs', list())
@@ -176,7 +176,7 @@ class SubscriptionManager(WebGETManager):
APP().systemTray.ConnectAction.trigger()
if showMessageBox:
mbox = UpdateSubsInfoMBox(
mbox = MBoxUpdateSubsInfo(
successArgs=successArgs,
failureArgs=failureArgs,
parent=kwargs.pop('parent', None),
@@ -1161,7 +1161,7 @@ class UserServersQTableWidget(Mixins.QTranslatable, AppQTableWidget):
if guiEditor is None:
# Unrecognized.
showUnrecognizedConfigMBox()
showMBoxUnrecognizedConfig()
return
@@ -1204,7 +1204,7 @@ class UserServersQTableWidget(Mixins.QTranslatable, AppQTableWidget):
self.flushRow(index, factory)
if modified and index == Storage.UserActivatedItemIndex():
showNewChangesNextTimeMBox()
showMBoxNewChangesNextTime()
editor.accepted.disconnect()
editor.rejected.disconnect()
@@ -1564,10 +1564,10 @@ class UserServersQTableWidget(Mixins.QTranslatable, AppQTableWidget):
if PLATFORM == 'Windows':
# Windows
mbox = QuestionDeleteMBox(icon=AppQMessageBox.Icon.Question)
mbox = MBoxQuestionDelete(icon=AppQMessageBox.Icon.Question)
else:
# macOS & linux
mbox = QuestionDeleteMBox(
mbox = MBoxQuestionDelete(
icon=AppQMessageBox.Icon.Question, parent=self.parent()
)
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
+2 -2
View File
@@ -258,10 +258,10 @@ class UserSubsQTableWidget(Mixins.QTranslatable, AppQTableWidget):
if PLATFORM == 'Windows':
# Windows
mbox = QuestionDeleteMBox(icon=AppQMessageBox.Icon.Question)
mbox = MBoxQuestionDelete(icon=AppQMessageBox.Icon.Question)
else:
# macOS & linux
mbox = QuestionDeleteMBox(
mbox = MBoxQuestionDelete(
icon=AppQMessageBox.Icon.Question, parent=self.parent()
)
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
+4 -4
View File
@@ -38,7 +38,7 @@ __all__ = ['XrayAssetViewerQListWidget']
logger = logging.getLogger(__name__)
class AssetExistsMBox(AppQMessageBox):
class MBoxAssetExists(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -191,7 +191,7 @@ class XrayAssetViewerQListWidget(Mixins.ThemeAware, AppQListWidget):
# Do not overwrite
pass
mbox = AssetExistsMBox(icon=AppQMessageBox.Icon.Question)
mbox = MBoxAssetExists(icon=AppQMessageBox.Icon.Question)
mbox.setWindowTitle(_('Import'))
mbox.setText(_('Asset file already exists. Overwrite?'))
mbox.setInformativeText(basename)
@@ -223,10 +223,10 @@ class XrayAssetViewerQListWidget(Mixins.ThemeAware, AppQListWidget):
if PLATFORM == 'Windows':
# Windows
mbox = QuestionDeleteMBox(icon=AppQMessageBox.Icon.Question)
mbox = MBoxQuestionDelete(icon=AppQMessageBox.Icon.Question)
else:
# macOS & linux
mbox = QuestionDeleteMBox(
mbox = MBoxQuestionDelete(
icon=AppQMessageBox.Icon.Question, parent=self.parent()
)
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
+2 -2
View File
@@ -26,7 +26,7 @@ from PySide6.QtWidgets import *
__all__ = ['LogViewerWindow']
class SaveErrorMBox(AppQMessageBox):
class MBoxSaveError(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -59,7 +59,7 @@ def saveAsFile(content: str):
except Exception as ex:
# Any non-exit exceptions
mbox = SaveErrorMBox(icon=AppQMessageBox.Icon.Critical)
mbox = MBoxSaveError(icon=AppQMessageBox.Icon.Critical)
mbox.saveError = str(ex)
mbox.setWindowTitle(_('Error saving log'))
mbox.setText(mbox.customText())
+6 -6
View File
@@ -34,7 +34,7 @@ __all__ = ['TextEditorWindow']
registerAppSettings('ServerWidgetPointSize')
class QuestionSaveMBox(AppQMessageBox):
class MBoxQuestionSave(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -50,7 +50,7 @@ class QuestionSaveMBox(AppQMessageBox):
self.setDefaultButton(self.button0)
class JSONDecodeErrorMBox(AppQMessageBox):
class MBoxJSONDecodeError(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -250,7 +250,7 @@ class TextEditorWindow(AppQMainWindow):
except Exception as ex:
# Any non-exit exceptions
mbox = JSONDecodeErrorMBox(icon=AppQMessageBox.Icon.Critical, parent=self)
mbox = MBoxJSONDecodeError(icon=AppQMessageBox.Icon.Critical, parent=self)
mbox.error = str(ex)
mbox.setWindowTitle(_('Error saving configuration'))
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
@@ -276,7 +276,7 @@ class TextEditorWindow(AppQMainWindow):
pass
if index == Storage.UserActivatedItemIndex():
showNewChangesNextTimeMBox(parent=self, method=showChangesMethod)
showMBoxNewChangesNextTime(parent=self, method=showChangesMethod)
self.markAsSaved()
@@ -313,7 +313,7 @@ class TextEditorWindow(AppQMainWindow):
except Exception as ex:
# Any non-exit exceptions
mbox = JSONDecodeErrorMBox(
mbox = MBoxJSONDecodeError(
icon=AppQMessageBox.Icon.Critical, parent=self
)
mbox.error = str(ex)
@@ -358,7 +358,7 @@ class TextEditorWindow(AppQMainWindow):
def closeEvent(self, event: QtCore.QEvent):
if self.modified:
mbox = QuestionSaveMBox(icon=AppQMessageBox.Icon.Question, parent=self)
mbox = MBoxQuestionSave(icon=AppQMessageBox.Icon.Question, parent=self)
mbox.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
def handleButtonClicked(button):