mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
fix
This commit is contained in:
parent
ce3808b948
commit
010579f20b
@ -1014,7 +1014,7 @@ class WebivewWidget(abstractwebview):
|
||||
webview_native_handle_kind_t.WEBVIEW_NATIVE_HANDLE_KIND_UI_WIDGET
|
||||
)
|
||||
|
||||
def __init__(self, parent=None, debug=True) -> None:
|
||||
def __init__(self, parent=None, debug=True, usedarklight=True) -> None:
|
||||
super().__init__(parent)
|
||||
declare_library_path(
|
||||
os.path.abspath(
|
||||
@ -1036,13 +1036,13 @@ class WebivewWidget(abstractwebview):
|
||||
self.keepref = [zoomfunc]
|
||||
self.webview.bind("__on_load", self._on_load)
|
||||
self.webview.init("""window.__on_load(window.location.href)""")
|
||||
|
||||
self.__darkstate = None
|
||||
t = QTimer(self)
|
||||
t.setInterval(100)
|
||||
t.timeout.connect(self.__darkstatechecker)
|
||||
t.timeout.emit()
|
||||
t.start()
|
||||
if usedarklight:
|
||||
self.__darkstate = None
|
||||
t = QTimer(self)
|
||||
t.setInterval(100)
|
||||
t.timeout.connect(self.__darkstatechecker)
|
||||
t.timeout.emit()
|
||||
t.start()
|
||||
|
||||
def __darkstatechecker(self):
|
||||
dl = globalconfig["darklight2"]
|
||||
|
@ -46,7 +46,7 @@ class TextBrowser(QWidget, dataget):
|
||||
self.webivewwidget.on_load.connect(self.__loadextra)
|
||||
else:
|
||||
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
|
||||
self.webivewwidget = WebivewWidget(self)
|
||||
self.webivewwidget = WebivewWidget(self, usedarklight=False)
|
||||
|
||||
# webview2无法接收qt事件。
|
||||
webviewhwnd = self.webivewwidget.get_hwnd()
|
||||
|
Loading…
x
Reference in New Issue
Block a user