From ef522275232d6ea2ca09bdef88e9b5c1459e968a 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: Wed, 29 May 2024 12:42:12 +0800 Subject: [PATCH] repair --- LunaTranslator/LunaTranslator/gui/edittext.py | 11 ++++------- LunaTranslator/LunaTranslator/myutils/wrapper.py | 8 ++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/edittext.py b/LunaTranslator/LunaTranslator/gui/edittext.py index 9094f2b7..0811a8fa 100644 --- a/LunaTranslator/LunaTranslator/gui/edittext.py +++ b/LunaTranslator/LunaTranslator/gui/edittext.py @@ -122,13 +122,10 @@ class edittrans(QMainWindow): self.trykeeppos() def trykeeppos(self): - try: - self.followhwnd = gobject.baseobject.textsource.hwnd - self.follow() - self.show() - except: - pass - + self.followhwnd = gobject.baseobject.textsource.hwnd + self.follow() + self.show() + @threader def follow(self): while True: diff --git a/LunaTranslator/LunaTranslator/myutils/wrapper.py b/LunaTranslator/LunaTranslator/myutils/wrapper.py index b00bf14e..3f35bfe0 100644 --- a/LunaTranslator/LunaTranslator/myutils/wrapper.py +++ b/LunaTranslator/LunaTranslator/myutils/wrapper.py @@ -43,8 +43,12 @@ def Singleton_impl(cls, behavior="activate"): self.deleteLater() _instance.pop(cls) _lock.release() - - _inst = __(*args, **kwagrs) + try: + _inst = __(*args, **kwagrs) + except: + print_exc() + _lock.release() + return None if _inst.Singleton_flag: _instance[cls] = _inst return _inst