This commit is contained in:
恍兮惚兮 2024-04-30 02:10:30 +08:00
parent 98fd9a0af1
commit b5a54ea537
2 changed files with 8 additions and 16 deletions

View File

@ -11,7 +11,7 @@ from PyQt5.QtWidgets import (
QWidget,
)
from webviewpy import webview_native_handle_kind_t, Webview, declare_library_path
from webviewpy import webview_error_t, webview_native_handle_kind_t, Webview, declare_library_path
from PyQt5.QtGui import QCursor, QCloseEvent, QColor, QTextCursor, QResizeEvent
from PyQt5.QtCore import Qt, pyqtSignal, QSize
from myutils.config import _TR, globalconfig
@ -545,10 +545,14 @@ class WebivewWidget(QWidget):
)
)
)
self.webview = Webview(debug=debug, window=int(self.winId()))
class _Webview(Webview):
def navigate(_, url: str) -> webview_error_t:
self.on_load.emit(url)
return super().navigate(url)
self.webview = _Webview(debug=debug, window=int(self.winId()))
self.webview.bind("__on_load", self._on_load)
self.webview.init("""window.__on_load(window.location.href)""")
#self.webview.bind("__on_load", self._on_load)
#self.webview.init("""window.__on_load(window.location.href)""")
def _on_load(self, _, href):
self.on_load.emit(json.loads(href)[0])

View File

@ -151,18 +151,6 @@ def everymethodsthread():
savehook_new_data[gamepath]["title"] = title
if infopath:
savehook_new_data[gamepath]["infopath"] = infopath
found = False
for link in savehook_new_data[gamepath]["relationlinks"]:
if link[1] == found:
found = True
if not found:
savehook_new_data[gamepath]["relationlinks"].append(
[vid, f"https://vndb.org/{vid}"]
)
savehook_new_data[gamepath]["relationlinks"].append(
[vid + "_static", infopath]
)
if namemap:
savehook_new_data[gamepath]["namemap"] = namemap
if vndbtags: