diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index ac70f6fd..78bbb2c1 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -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]) diff --git a/LunaTranslator/LunaTranslator/myutils/utils.py b/LunaTranslator/LunaTranslator/myutils/utils.py index 95f2e1dc..1b5ecd82 100644 --- a/LunaTranslator/LunaTranslator/myutils/utils.py +++ b/LunaTranslator/LunaTranslator/myutils/utils.py @@ -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: