diff --git a/LunaTranslator/LunaTranslator/gui/textbrowser.py b/LunaTranslator/LunaTranslator/gui/textbrowser.py index b50fde19..78bae20f 100644 --- a/LunaTranslator/LunaTranslator/gui/textbrowser.py +++ b/LunaTranslator/LunaTranslator/gui/textbrowser.py @@ -6,7 +6,7 @@ import importlib class Textbrowser(QLabel): contentsChanged = pyqtSignal(QSize) - _padding = 10 + _padding = 5 def __makeborder(self, size: QSize): _padding = self._padding diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 230b3715..18eb464f 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -151,7 +151,7 @@ class QUnFrameWindow(resizableframeless): clear = kwargs.get("clear", True) origin = kwargs.get("origin", True) text = kwargs.get("text", None) - color = kwargs.get("color", 'black') + color = kwargs.get("color", "black") isshowrawtext = kwargs.get("isshowrawtext", False) iter_context = kwargs.get("iter_context", None) @@ -222,15 +222,13 @@ class QUnFrameWindow(resizableframeless): if flag: self.show_() - self.enterfunction() else: self.hide_() def leftclicktray(self, reason): # 鼠标左键点击 if reason == QSystemTrayIcon.Trigger: - self.show_() - self.enterfunction() + self.showhideui() def refreshtoolicon(self): iconstate = { @@ -589,6 +587,10 @@ class QUnFrameWindow(resizableframeless): self.addbuttons() self.translate_text = Textbrowser(self) self.translate_text.contentsChanged.connect(self.textAreaChanged) + t = QTimer(self) + t.setInterval(100) + t.timeout.connect(self.__betterenterevent) + t.start() def createborderradiusstring(self, r, merge, top=False): if merge: @@ -865,14 +867,15 @@ class QUnFrameWindow(resizableframeless): self._TitleLabel.hide() self.set_color_transparency() - def enterEvent(self, QEvent): - self.enterfunction() + def __betterenterevent(self): + if self.geometry().contains(QCursor.pos()): + self.enterfunction() @threader def dodelayhide(self, delay): enter_sig = time.time() self.enter_sig = enter_sig - while self.underMouse(): + while self.geometry().contains(QCursor.pos()): time.sleep(0.1) time.sleep(delay) if self.enter_sig != enter_sig: diff --git a/LunaTranslator/LunaTranslator/rendertext/webview.py b/LunaTranslator/LunaTranslator/rendertext/webview.py index b9e3e213..75a2b03a 100644 --- a/LunaTranslator/LunaTranslator/rendertext/webview.py +++ b/LunaTranslator/LunaTranslator/rendertext/webview.py @@ -92,7 +92,7 @@ class TextBrowser(QWidget, dataget): def calllunaheightchange(self, h): self.contentsChanged.emit( - QSize(self.width(), h * self.webivewwidget.get_ZoomFactor()) + QSize(self.width(), int(h * self.webivewwidget.get_ZoomFactor())) ) def internalheighchange(self): diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 875ba862..898a0a3b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 0) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)