From 2623b880820345f45a9a7421b5e39b6692da9283 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: Mon, 27 May 2024 16:39:16 +0800 Subject: [PATCH] faster --- LunaTranslator/LunaTranslator/gui/settin.py | 6 ------ .../LunaTranslator/gui/settingpage_xianshishezhi.py | 2 +- LunaTranslator/LunaTranslator/gui/translatorUI.py | 9 +++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/settin.py b/LunaTranslator/LunaTranslator/gui/settin.py index 18c6912c..7233c53d 100644 --- a/LunaTranslator/LunaTranslator/gui/settin.py +++ b/LunaTranslator/LunaTranslator/gui/settin.py @@ -259,12 +259,6 @@ class Settin(closeashidewindow): for widget in QApplication.topLevelWidgets(): if widget.testAttribute(Qt.WA_TranslucentBackground): - if globalconfig["WindowEffect"] == 0: - winsharedutils.clearEffect(int(widget.winId())) - elif globalconfig["WindowEffect"] == 1: - winsharedutils.setAcrylicEffect(int(widget.winId())) - elif globalconfig["WindowEffect"] == 2: - winsharedutils.setAeroEffect(int(widget.winId())) continue winsharedutils.SetTheme( int(widget.winId()), dark, globalconfig["WindowBackdrop"] diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py index 44372142..4f043a73 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py @@ -654,8 +654,8 @@ def setTabThree_lazy(self): globalconfig, "WindowEffect", callback=lambda _: [ - self.setstylesheet(), gobject.baseobject.translation_ui.set_color_transparency(), + gobject.baseobject.translation_ui.seteffect(), ], ), 5, diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index ede48a6b..c68c6b99 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -346,6 +346,7 @@ class QUnFrameWindow(resizableframeless): self.setMinimumHeight(int(globalconfig["buttonsize"] * 1.5 + 10)) self.setMinimumWidth(globalconfig["buttonsize"] * 2) self.set_color_transparency() + self.seteffect() self.adjustbuttons() def ocr_once_function(self): @@ -575,6 +576,14 @@ class QUnFrameWindow(resizableframeless): threading.Thread(target=_).start() + def seteffect(self): + if globalconfig["WindowEffect"] == 0: + winsharedutils.clearEffect(int(self.winId())) + elif globalconfig["WindowEffect"] == 1: + winsharedutils.setAcrylicEffect(int(self.winId())) + elif globalconfig["WindowEffect"] == 2: + winsharedutils.setAeroEffect(int(self.winId())) + def __init__(self): super(QUnFrameWindow, self).__init__(