From 60694452567fee48b636febede4a7ebc97643169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Mon, 20 Jan 2025 00:00:20 +0800 Subject: [PATCH] . --- py/LunaTranslator/gui/textbrowser.py | 5 ----- py/LunaTranslator/rendertext/webview.py | 13 +++++-------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/py/LunaTranslator/gui/textbrowser.py b/py/LunaTranslator/gui/textbrowser.py index e76705a0db7..9a083167185 100644 --- a/py/LunaTranslator/gui/textbrowser.py +++ b/py/LunaTranslator/gui/textbrowser.py @@ -121,11 +121,6 @@ def loadinternal(self, shoudong=False): self.textbrowser.dropfilecallback.connect(self.normdropfilepath) self.textbrowser.resize(size) self.textbrowser.show() - self.textbrowser.setselectable(globalconfig["selectable"]) - self.textbrowser.showhideerror(globalconfig["showtranexception"]) - self.textbrowser.showhideorigin(globalconfig["isshowrawtext"]) - self.textbrowser.showhidetranslate(globalconfig["showfanyi"]) - self.textbrowser.showatcenter(globalconfig["showatcenter"]) self.refreshcontent() def normdropfilepath(self, file): diff --git a/py/LunaTranslator/rendertext/webview.py b/py/LunaTranslator/rendertext/webview.py index 81fcc5a1e7c..d4f736826cb 100644 --- a/py/LunaTranslator/rendertext/webview.py +++ b/py/LunaTranslator/rendertext/webview.py @@ -57,7 +57,6 @@ def __init__(self, parent) -> None: self.webivewwidget.bind("calllunaloadready", self.resetflags) self.saveiterclasspointer = {} self.isfirst = True - self.flags = {} self.colorset = set() def ___cleartext(self): @@ -66,8 +65,11 @@ def ___cleartext(self): def resetflags(self): self.colorset.clear() - for k, v in self.flags.items(): - self.debugeval("{}({})".format(k, int(v))) + self.setselectable(globalconfig["selectable"]) + self.showhideerror(globalconfig["showtranexception"]) + self.showhideorigin(globalconfig["isshowrawtext"]) + self.showhidetranslate(globalconfig["showfanyi"]) + self.showatcenter(globalconfig["showatcenter"]) self.setfontstyle() self.parent().refreshcontent() @@ -142,23 +144,18 @@ def debugeval(self, js): # js api def setselectable(self, b): self.debugeval("setselectable({})".format(int(b))) - self.flags["setselectable"] = b def showatcenter(self, show): self.debugeval("showatcenter({})".format(int(show))) - self.flags["showatcenter"] = show def showhidetranslate(self, show): self.debugeval("showhidetranslate({})".format(int(show))) - self.flags["showhidetranslate"] = show def showhideorigin(self, show): self.debugeval("showhideorigin({})".format(int(show))) - self.flags["showhideorigin"] = show def showhideerror(self, show): self.debugeval("showhideerror({})".format(int(show))) - self.flags["showhideerror"] = show def create_div_line_id(self, _id, texttype: TextType): self.debugeval('create_div_line_id("{}",{})'.format(_id, texttype))