Add showUnrecognizedConfigMBox

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2025-02-23 17:42:48 +08:00
parent 9eb52d4060
commit 9816a4243f
4 changed files with 43 additions and 1 deletions
+8
View File
@@ -35,6 +35,14 @@ TRANSLATION = {
"ZH": "新的更改将于下次生效",
"isReviewed": "True"
},
"Unrecognized Configuration. Please modify it in the editor": {
"source": [
"Furious.QtFramework.QtWidgets"
],
"RU": "Нераспознанная конфигурация. Пожалуйста, измените его в редакторе",
"ZH": "无法识别的配置。请在编辑器中修改",
"isReviewed": "True"
},
"New version available": {
"source": [
"Furious.QtFramework.UpdatesManager"
+27
View File
@@ -51,6 +51,8 @@ __all__ = [
'QuestionDeleteMBox',
'NewChangesNextTimeMBox',
'showNewChangesNextTimeMBox',
'UnrecognizedConfigMBox',
'showUnrecognizedConfigMBox',
]
needTrans = functools.partial(needTransFn, source=__name__)
@@ -609,3 +611,28 @@ def showNewChangesNextTimeMBox(**kwargs):
# Any non-exit exceptions
pass
needTrans(
'Unrecognized Configuration. Please modify it in the editor',
)
class UnrecognizedConfigMBox(AppQMessageBox):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setIcon(AppQMessageBox.Icon.Critical)
self.setText(_('Unrecognized Configuration. Please modify it in the editor'))
def showUnrecognizedConfigMBox(**kwargs):
mbox = UnrecognizedConfigMBox(**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()
+3 -1
View File
@@ -921,7 +921,9 @@ class UserServersQTableWidget(QTranslatable, AppQTableWidget):
guiEditor = self.getGuiEditorByFactory(factory, translatable=False)
if guiEditor is None:
# Unrecognized. Do nothing
# Unrecognized.
showUnrecognizedConfigMBox()
return
guiEditor.setWindowTitle(f'{index + 1} - ' + factory.getExtras('remark'))
+5
View File
@@ -248,6 +248,11 @@ class AppMainWindow(AppQMainWindow):
Protocol.Hysteria2, _('Add Hysteria2 Server...')
),
),
AppQSeperator(),
AppQAction(
_('New Empty Configuration'),
callback=lambda: self.userServersQTableWidget.newEmptyItem(),
),
]
subsActions = [