mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
autohide
This commit is contained in:
parent
0b47580088
commit
7abc23f171
@ -405,7 +405,7 @@ class TranslatorWindow(resizableframeless):
|
|||||||
iter_res_status = 0
|
iter_res_status = 0
|
||||||
if iter_res_status:
|
if iter_res_status:
|
||||||
self.translate_text.iter_append(
|
self.translate_text.iter_append(
|
||||||
iter_context_class, origin, atcenter,name, text, color
|
iter_context_class, origin, atcenter, name, text, color
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.translate_text.append(
|
self.translate_text.append(
|
||||||
@ -430,12 +430,21 @@ class TranslatorWindow(resizableframeless):
|
|||||||
@threader
|
@threader
|
||||||
def autohidedelaythread(self):
|
def autohidedelaythread(self):
|
||||||
while True:
|
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:
|
if globalconfig["autodisappear"] and self.autohidestart:
|
||||||
tnow = time.time()
|
if (
|
||||||
if tnow - self.lastrefreshtime >= globalconfig["disappear_delay"]:
|
time.time() - self.lastrefreshtime
|
||||||
|
>= globalconfig["disappear_delay"]
|
||||||
|
):
|
||||||
self.hidesignal.emit()
|
self.hidesignal.emit()
|
||||||
self.autohidestart = False
|
self.autohidestart = False
|
||||||
self.lastrefreshtime = tnow
|
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 53)
|
set(VERSION_MINOR 53)
|
||||||
set(VERSION_PATCH 12)
|
set(VERSION_PATCH 13)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user