mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-04 04:48:00 +03:00
Add showUnrecognizedConfigMBox
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Vendored
+8
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -248,6 +248,11 @@ class AppMainWindow(AppQMainWindow):
|
||||
Protocol.Hysteria2, _('Add Hysteria2 Server...')
|
||||
),
|
||||
),
|
||||
AppQSeperator(),
|
||||
AppQAction(
|
||||
_('New Empty Configuration'),
|
||||
callback=lambda: self.userServersQTableWidget.newEmptyItem(),
|
||||
),
|
||||
]
|
||||
|
||||
subsActions = [
|
||||
|
||||
Reference in New Issue
Block a user