From cb00a8f2b0f8e2a831a97bd9342733236a51a449 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: Tue, 18 Jun 2024 13:59:28 +0800 Subject: [PATCH] focus --- LunaTranslator/LunaTranslator/gui/setting_display_text.py | 3 ++- LunaTranslator/LunaTranslator/gui/setting_display_ui.py | 3 ++- LunaTranslator/LunaTranslator/gui/setting_textinput.py | 5 +++-- LunaTranslator/LunaTranslator/gui/usefulwidget.py | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_text.py b/LunaTranslator/LunaTranslator/gui/setting_display_text.py index 05fe93d9..61981efa 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_text.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_text.py @@ -11,6 +11,7 @@ from gui.usefulwidget import ( D_getcolorbutton, D_getsimpleswitch, selectcolor, + FocusFontCombo ) @@ -38,7 +39,7 @@ def __changeuibuttonstate(self, x): def createtextfontcom(key): - font_comboBox = QFontComboBox() + font_comboBox = FocusFontCombo() font_comboBox.currentTextChanged.connect(lambda x: globalconfig.__setitem__(key, x)) font_comboBox.setCurrentFont(QFont(globalconfig[key])) return font_comboBox diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py index 4ba0d8f1..7ded57a9 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py @@ -10,6 +10,7 @@ from gui.usefulwidget import ( D_getcolorbutton, getcolorbutton, selectcolor, + FocusFontCombo ) @@ -82,7 +83,7 @@ def createhorizontal_slider_tool_label(self): def createfontcombo(): - sfont_comboBox = QFontComboBox() + sfont_comboBox = FocusFontCombo() def callback(x): globalconfig.__setitem__("settingfonttype", x) diff --git a/LunaTranslator/LunaTranslator/gui/setting_textinput.py b/LunaTranslator/LunaTranslator/gui/setting_textinput.py index bb072076..c4547a21 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_textinput.py +++ b/LunaTranslator/LunaTranslator/gui/setting_textinput.py @@ -25,7 +25,8 @@ from gui.usefulwidget import ( D_getsimpleswitch, makesubtab_lazy, makescrollgrid, - FocusCombo + FocusCombo, + FocusFontCombo ) @@ -269,7 +270,7 @@ def exportchspatch(self): def creategamefont_comboBox(): - gamefont_comboBox = QFontComboBox() + gamefont_comboBox = FocusFontCombo() def callback(x): globalconfig["embedded"].__setitem__("changefont_font", x) diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 682e3c22..fecfb145 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -27,6 +27,9 @@ class FocusCombo(QComboBox): return super().wheelEvent(e) +class FocusFontCombo(QFontComboBox, FocusCombo): + pass + class FocusSpin(QSpinBox): def __init__(self, parent: QWidget = None) -> None: super().__init__(parent)