From b88a4049e4a671251917ca2d5da4f8921e3bf282 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, 19 Jun 2024 10:22:30 +0800 Subject: [PATCH] perf --- LunaTranslator/LunaTranslator/gui/translatorUI.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 18eb464f..c7f3d406 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -589,6 +589,7 @@ class QUnFrameWindow(resizableframeless): self.translate_text.contentsChanged.connect(self.textAreaChanged) t = QTimer(self) t.setInterval(100) + self._isentered = False t.timeout.connect(self.__betterenterevent) t.start() @@ -868,7 +869,8 @@ class QUnFrameWindow(resizableframeless): self.set_color_transparency() def __betterenterevent(self): - if self.geometry().contains(QCursor.pos()): + if (not self._isentered) and self.geometry().contains(QCursor.pos()): + self._isentered = True self.enterfunction() @threader @@ -877,6 +879,7 @@ class QUnFrameWindow(resizableframeless): self.enter_sig = enter_sig while self.geometry().contains(QCursor.pos()): time.sleep(0.1) + self._isentered = False time.sleep(delay) if self.enter_sig != enter_sig: return