Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jan 19, 2025
1 parent 9b9c1f7 commit 6069445
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
5 changes: 0 additions & 5 deletions py/LunaTranslator/gui/textbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 5 additions & 8 deletions py/LunaTranslator/rendertext/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 6069445

Please sign in to comment.