diff --git a/src/LunaTranslator/gui/translatorUI.py b/src/LunaTranslator/gui/translatorUI.py index 40b5715f..649d2ca9 100644 --- a/src/LunaTranslator/gui/translatorUI.py +++ b/src/LunaTranslator/gui/translatorUI.py @@ -405,7 +405,7 @@ class TranslatorWindow(resizableframeless): iter_res_status = 0 if iter_res_status: self.translate_text.iter_append( - iter_context_class, origin, atcenter,name, text, color + iter_context_class, origin, atcenter, name, text, color ) else: self.translate_text.append( @@ -430,12 +430,21 @@ class TranslatorWindow(resizableframeless): @threader def autohidedelaythread(self): while True: + # 当鼠标悬停,或前景窗口为当前进程的其他窗口时,禁止自动隐藏 + if self.geometry().contains(QCursor.pos()) or ( + windows.GetForegroundWindow() != self.winid + and windows.GetWindowThreadProcessId(windows.GetForegroundWindow()) + == os.getpid() + ): + self.lastrefreshtime = time.time() + continue if globalconfig["autodisappear"] and self.autohidestart: - tnow = time.time() - if tnow - self.lastrefreshtime >= globalconfig["disappear_delay"]: + if ( + time.time() - self.lastrefreshtime + >= globalconfig["disappear_delay"] + ): self.hidesignal.emit() self.autohidestart = False - self.lastrefreshtime = tnow time.sleep(0.5) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 2bb48bdb..f43c7c9c 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 53) -set(VERSION_PATCH 12) +set(VERSION_PATCH 13) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)