From c609330e41bdaad643d4296745359d7cd6c61ebf 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, 5 Jun 2024 06:37:30 +0800 Subject: [PATCH] .. --- LunaTranslator/LunaTranslator/gui/showword.py | 1 - LunaTranslator/LunaTranslator/gui/usefulwidget.py | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index dfad7d3f..e532da65 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -751,7 +751,6 @@ class searchwordW(closeashidewindow): html = self.cache_results[self.tabks[idx]] except: return - self.textOutput.set_zoom(globalconfig["ZoomFactor"]) self.textOutput.setHtml(html) def setupUi(self): diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 6e7158be..98c1148f 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -788,6 +788,7 @@ class QWebWrap(abstractwebview): t.start(0) def set_zoom(self, zoom): + self.internal_zoom = zoom self.internal.setZoomFactor(zoom) def __getzoomfactor(self): @@ -819,10 +820,12 @@ class auto_select_webview(QWidget): def navigate(self, url): self._maybecreate() + self.internal.set_zoom(self.internalsavedzoom) self.internal.navigate(url) def setHtml(self, html): self._maybecreate() + self.internal.set_zoom(self.internalsavedzoom) html = self.internal.parsehtml(html) if len(html) < self.internal.html_limit: self.internal.setHtml(html) @@ -834,6 +837,7 @@ class auto_select_webview(QWidget): self.internal.navigate(lastcachehtml) def set_zoom(self, zoom): + self.internalsavedzoom = zoom self.internal.set_zoom(zoom) def sizeHint(self): @@ -870,6 +874,9 @@ class auto_select_webview(QWidget): if self.internal: self.layout().removeWidget(self.internal) self.internal = self._createwebview() + self.internal.set_zoom(self.internalsavedzoom) + self.internal.on_load.connect(self.on_load) + self.internal.on_ZoomFactorChanged.connect(self.internalzoomchanged) self.layout().addWidget(self.internal) def _createwebview(self): @@ -885,9 +892,6 @@ class auto_select_webview(QWidget): print_exc() self.is_fallback = self.contex browser = mshtmlWidget() - browser.set_zoom(self.internalsavedzoom) - browser.on_load.connect(self.on_load) - browser.on_ZoomFactorChanged.connect(self.internalzoomchanged) return browser