Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jan 9, 2025
1 parent e9c8716 commit 7fc52ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions py/LunaTranslator/gui/usefulwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def add_menu(self, index, label, callback):
self.callbacks.append(__)
winsharedutils.add_menu_list(self.menudata, index, label, __)

def __init__(self, parent=None, debug=True, usedarklight=True) -> None:
def __init__(self, parent=None, debug=True) -> None:
super().__init__(parent)
self.webview = None
self.callbacks = []
Expand All @@ -1244,13 +1244,13 @@ def __init__(self, parent=None, debug=True, usedarklight=True) -> None:
)
self.webview.bind("__on_load", self._on_load)
self.webview.init("""window.__on_load(window.location.href)""")
if usedarklight:
self.__darkstate = None
t = QTimer(self)
t.setInterval(100)
t.timeout.connect(self.__darkstatechecker)
t.timeout.emit()
t.start()

self.__darkstate = None
t = QTimer(self)
t.setInterval(100)
t.timeout.connect(self.__darkstatechecker)
t.timeout.emit()
t.start()

self.add_menu(0, "", lambda _: None)

Expand Down
2 changes: 1 addition & 1 deletion py/LunaTranslator/rendertext/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, parent) -> None:
super().__init__(parent)
self.selectable = False
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
self.webivewwidget = WebivewWidget(self, usedarklight=False)
self.webivewwidget = WebivewWidget(self)

webviewhwnd = self.webivewwidget.get_hwnd()
self.wndproc = windows.WNDPROCTYPE(
Expand Down

0 comments on commit 7fc52ef

Please sign in to comment.