mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
use
This commit is contained in:
parent
b97b97eee0
commit
7657b13c5f
@ -13,9 +13,11 @@ from gui.usefulwidget import (
|
||||
getQMessageBox,
|
||||
D_getspinbox,
|
||||
D_getIconButton,
|
||||
getboxlayout,
|
||||
D_getcolorbutton,
|
||||
getcolorbutton,
|
||||
MySwitch,
|
||||
getsimpleswitch,
|
||||
D_getsimpleswitch,
|
||||
selectcolor,
|
||||
listediter,
|
||||
@ -246,8 +248,17 @@ def resetgroudswitchcallback(self, group):
|
||||
self.seletengeinecombo.lastindex = self.seletengeinecombo.currentIndex()
|
||||
if group == "webview" or group == "QWebEngine":
|
||||
_btn = LPushButton("额外的html")
|
||||
self.goodfontsettingsformlayout.addRow(_btn)
|
||||
_btn.clicked.connect(lambda: extrahtml(self))
|
||||
switch = getsimpleswitch(
|
||||
globalconfig,
|
||||
"useextrahtml",
|
||||
callback=lambda x: [
|
||||
gobject.baseobject.translation_ui.translate_text.textbrowser.loadextra(0),
|
||||
_btn.setEnabled(x),
|
||||
],
|
||||
)
|
||||
_btn.setEnabled(globalconfig["useextrahtml"])
|
||||
self.goodfontsettingsformlayout.addRow(getboxlayout([_btn, switch]))
|
||||
if group == "QWebEngine":
|
||||
group = "webview"
|
||||
__form = LFormLayout()
|
||||
|
@ -109,10 +109,10 @@ class TextBrowser(QWidget, dataget):
|
||||
if not isinstance(self.webivewwidget, WebivewWidget):
|
||||
return
|
||||
self.isfirst = False
|
||||
self.__loadextra(0)
|
||||
self.webivewwidget.on_load.connect(self.__loadextra)
|
||||
self.loadextra(0)
|
||||
self.webivewwidget.on_load.connect(self.loadextra)
|
||||
|
||||
def __loadextra(self, _):
|
||||
def loadextra(self, _):
|
||||
for _ in [
|
||||
"userconfig/extrahtml.html",
|
||||
r"LunaTranslator\rendertext\exampleextrahtml.html",
|
||||
@ -136,6 +136,9 @@ class TextBrowser(QWidget, dataget):
|
||||
self.debugeval(f"clear_all()")
|
||||
|
||||
def set_extra_html(self, html):
|
||||
if not globalconfig["useextrahtml"]:
|
||||
self.debugeval(f'set_extra_html("")')
|
||||
return
|
||||
html = quote(html)
|
||||
self.debugeval(f'set_extra_html("{html}")')
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
"read_translator": 0,
|
||||
"disappear_delay": 5,
|
||||
"network": 1,
|
||||
"useextrahtml": true,
|
||||
"network_websocket": 1,
|
||||
"webview_textbrowser": false,
|
||||
"imagewrapmode": 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user