From c99880272a12ccde056a9afa71c19acd0b65b037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 2 Aug 2024 22:55:30 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/gui/inputdialog.py | 6 +++--- .../LunaTranslator/gui/setting_display_text.py | 13 ++++++++++--- LunaTranslator/LunaTranslator/gui/usefulwidget.py | 7 +++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/inputdialog.py b/LunaTranslator/LunaTranslator/gui/inputdialog.py index e44ed888..cd02bfa3 100644 --- a/LunaTranslator/LunaTranslator/gui/inputdialog.py +++ b/LunaTranslator/LunaTranslator/gui/inputdialog.py @@ -17,6 +17,7 @@ from gui.usefulwidget import ( FocusDoubleSpin, LFocusCombo, getsimplecombobox, + SplitLine, ) from gui.dynalang import ( LFormLayout, @@ -335,6 +336,7 @@ class noundictconfigdialog2(LDialog): self.button.setFocus() self.apply() + def autoinitdialog_items(dic): items = [] for arg in dic["args"]: @@ -505,9 +507,7 @@ class autoinitdialog(LDialog): lineW.setValue(dd[key]) lineW.valueChanged.connect(functools.partial(dd.__setitem__, key)) elif line["type"] == "split": - lineW = QLabel() - lineW.setStyleSheet("background-color: gray;") - lineW.setFixedHeight(2) + lineW = SplitLine() formLayout.addRow(lineW) continue refswitch = line.get("refswitch", None) diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_text.py b/LunaTranslator/LunaTranslator/gui/setting_display_text.py index c4748785..2002dcb1 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_text.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_text.py @@ -25,6 +25,7 @@ from gui.usefulwidget import ( LFocusCombo, FocusDoubleSpin, FocusSpin, + SplitLine, ) from gui.dynalang import LPushButton, LFormLayout @@ -247,18 +248,24 @@ def resetgroudswitchcallback(self, group): goodfontgroupswitch = LFocusCombo() self.seletengeinecombo.lastindex = self.seletengeinecombo.currentIndex() if group == "webview" or group == "QWebEngine": - _btn = LPushButton("额外的html") + _btn = LPushButton("编辑") _btn.clicked.connect(lambda: extrahtml(self)) switch = getsimpleswitch( globalconfig, "useextrahtml", callback=lambda x: [ - gobject.baseobject.translation_ui.translate_text.textbrowser.loadextra(0), + gobject.baseobject.translation_ui.translate_text.textbrowser.loadextra( + 0 + ), _btn.setEnabled(x), ], ) _btn.setEnabled(globalconfig["useextrahtml"]) - self.goodfontsettingsformlayout.addRow(getboxlayout([_btn, switch])) + self.goodfontsettingsformlayout.addRow( + "额外的html", + getboxlayout([switch, _btn]), + ) + self.goodfontsettingsformlayout.addRow(SplitLine()) if group == "QWebEngine": group = "webview" __form = LFormLayout() diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index ea72154d..89beeebb 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -2015,3 +2015,10 @@ class LIconLabel(LLabel): QIcon.Mode.Normal, QIcon.State.On, ) + + +class SplitLine(QFrame): + def __init__(self, *argc): + super().__init__(*argc) + self.setStyleSheet("background-color: gray;") + self.setFixedHeight(2)