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 5c43dfe commit 8d21bf5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
22 changes: 20 additions & 2 deletions py/LunaTranslator/gui/setting_display_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ def __init__(self, parent) -> None:
self.show()


def mayberefreshe():
if globalconfig["rendertext_using"] == "textbrowser":
return
gobject.baseobject.translation_ui.translate_text.refreshcontent()


def createinternalfontsettings(self, forml: LFormLayout, group, _type):
need = globalconfig["rendertext_using_internal"][group] != _type
globalconfig["rendertext_using_internal"][group] = _type
Expand Down Expand Up @@ -132,6 +138,7 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
keyx,
True,
widthline.get("step", 0.1),
callback=lambda _: mayberefreshe(),
),
__,
getspinbox(
Expand All @@ -141,6 +148,7 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
key,
True,
line.get("step", 0.1),
callback=lambda _: mayberefreshe(),
),
]
),
Expand All @@ -154,7 +162,11 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
key,
callback=functools.partial(
lambda dd, key: selectcolor(
self, dd, key, self.miaobian_color_button
self,
dd,
key,
self.miaobian_color_button,
callback=mayberefreshe,
),
dd,
key,
Expand All @@ -170,10 +182,16 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
key,
_type == "spin",
line.get("step", 0.1),
callback=lambda _: mayberefreshe(),
)
elif _type == "switch":
lineW = MySwitch(sign=dd[key])
lineW.clicked.connect(functools.partial(dd.__setitem__, key))

def __(dd, key, x):
dd[key] = x
mayberefreshe()

lineW.clicked.connect(functools.partial(__, dd, key))
forml.addRow(
name,
lineW,
Expand Down
4 changes: 2 additions & 2 deletions py/LunaTranslator/rendertext/webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@
}`
}
</script>
__PLACEHOLDER_EXTRA_HTML_
<script>
//api
setselectable = _setselectable
Expand All @@ -465,4 +464,5 @@
<script>
if (window.calllunaloadready)
window.calllunaloadready()
</script>
</script>
__PLACEHOLDER_EXTRA_HTML_
2 changes: 1 addition & 1 deletion py/LunaTranslator/rendertext/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def ___cleartext(self):
gobject.baseobject.currenttext = ""

def resetflags(self):
self.colorset.clear()
for k, v in self.flags.items():
self.debugeval("{}({})".format(k, int(v)))
self.setfontstyle()
Expand Down Expand Up @@ -306,7 +307,6 @@ def _getstylevalid(self):
return currenttype

def setcolors(self):
print(self.colorset)
mp = {}
for color in self.colorset:
mp[color.asklass()] = color.get()
Expand Down

0 comments on commit 8d21bf5

Please sign in to comment.