mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
fix
This commit is contained in:
parent
98fd9a0af1
commit
b5a54ea537
@ -11,7 +11,7 @@ from PyQt5.QtWidgets import (
|
|||||||
QWidget,
|
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.QtGui import QCursor, QCloseEvent, QColor, QTextCursor, QResizeEvent
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal, QSize
|
from PyQt5.QtCore import Qt, pyqtSignal, QSize
|
||||||
from myutils.config import _TR, globalconfig
|
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.bind("__on_load", self._on_load)
|
||||||
self.webview.init("""window.__on_load(window.location.href)""")
|
#self.webview.init("""window.__on_load(window.location.href)""")
|
||||||
|
|
||||||
def _on_load(self, _, href):
|
def _on_load(self, _, href):
|
||||||
self.on_load.emit(json.loads(href)[0])
|
self.on_load.emit(json.loads(href)[0])
|
||||||
|
@ -151,18 +151,6 @@ def everymethodsthread():
|
|||||||
savehook_new_data[gamepath]["title"] = title
|
savehook_new_data[gamepath]["title"] = title
|
||||||
if infopath:
|
if infopath:
|
||||||
savehook_new_data[gamepath]["infopath"] = 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:
|
if namemap:
|
||||||
savehook_new_data[gamepath]["namemap"] = namemap
|
savehook_new_data[gamepath]["namemap"] = namemap
|
||||||
if vndbtags:
|
if vndbtags:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user