From a14ca9ca30fa8fb94fd40a26633b3df063762f3a 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: Sat, 8 Jun 2024 16:43:01 +0800 Subject: [PATCH] . --- .../LunaTranslator/gui/setting_display_buttons.py | 8 ++++---- .../LunaTranslator/gui/setting_display_ui.py | 4 ++-- LunaTranslator/LunaTranslator/gui/usefulwidget.py | 14 ++------------ 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py b/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py index f6c04477..c3a0cc34 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py @@ -48,7 +48,7 @@ class dialog_selecticon(QDialog): self.close() -def doadjust(): +def doadjust(_): gobject.baseobject.translation_ui.enterfunction(delay=3) gobject.baseobject.translation_ui.adjustbuttons() @@ -77,7 +77,7 @@ def changerank(item, up, sortlist, savelist, savelay): savelist[idx2 + headoffset], savelist[idx + headoffset], ) - doadjust() + doadjust(None) def createbuttonwidget(self, lay): @@ -112,7 +112,7 @@ def createbuttonwidget(self, lay): D_getsimpleswitch( globalconfig["toolbutton"]["buttons"][k], "use", - callback=lambda _: doadjust(), + callback=doadjust, ), button_up, button_down, @@ -120,7 +120,7 @@ def createbuttonwidget(self, lay): _TRL(["居左", "居右", "居中"]), globalconfig["toolbutton"]["buttons"][k], "align", - callback=lambda _: doadjust(), + callback=doadjust, fixedsize=True, ), D_getcolorbutton( diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py index f2fa88dd..dfd32d00 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py @@ -202,7 +202,7 @@ def createbtnthemedark(self): return self.btnthemedark -def checkthemesettingvisandapply(self, _dark): +def checkthemesettingvisandapply(self, _dark, _): checkthemesettingvisandapply_1(self, _dark) maybesetstyle(_dark) @@ -319,7 +319,7 @@ def uisetting(self): _TRL(["明亮", "黑暗", "跟随系统"]), globalconfig, "darklight", - gobject.baseobject.setcommonstylesheet, + lambda _: gobject.baseobject.setcommonstylesheet(), ), 5, ), diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index fd48bcfd..76fe992e 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -369,12 +369,7 @@ def callbackwrap(d, k, call, _): d[k] = _ if call: try: - sig = inspect.signature(call) - np = len(sig.parameters) - if np >= 1: - call(_) - elif np == 0: - call() + call(_) except: print_exc() @@ -383,12 +378,7 @@ def comboboxcallbackwrap(internallist, d, k, call, _): d[k] = internallist[_] if call: try: - sig = inspect.signature(call) - np = len(sig.parameters) - if np >= 1: - call(_) - elif np == 0: - call() + call(_) except: print_exc()