mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
fix
This commit is contained in:
parent
b5a54ea537
commit
4a18ed4d46
@ -471,7 +471,7 @@ class _browserdialog(saveposwindow):
|
|||||||
|
|
||||||
def likelink(self):
|
def likelink(self):
|
||||||
_dia = Prompt_dialog(
|
_dia = Prompt_dialog(
|
||||||
gobject.baseobject.settin_ui,
|
self,
|
||||||
_TR("收藏"),
|
_TR("收藏"),
|
||||||
"",
|
"",
|
||||||
[
|
[
|
||||||
@ -487,17 +487,17 @@ class _browserdialog(saveposwindow):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
_dia.exec()
|
if _dia.exec():
|
||||||
|
|
||||||
text = []
|
text = []
|
||||||
for _t in _dia.text:
|
for _t in _dia.text:
|
||||||
text.append(_t.text())
|
text.append(_t.text())
|
||||||
if self.exepath:
|
if self.exepath:
|
||||||
savehook_new_data[self.exepath]["relationlinks"].append(text)
|
savehook_new_data[self.exepath]["relationlinks"].append(text)
|
||||||
self.tagswidget.addTag(text[0], tagitem.TYPE_GAME_LIKE, text[1])
|
self.tagswidget.addTag(text[0], tagitem.TYPE_GAME_LIKE, text[1])
|
||||||
else:
|
else:
|
||||||
globalconfig["relationlinks"].append(text)
|
globalconfig["relationlinks"].append(text)
|
||||||
self.tagswidget.addTag(text[0], tagitem.TYPE_GLOABL_LIKE, text[1])
|
self.tagswidget.addTag(text[0], tagitem.TYPE_GLOABL_LIKE, text[1])
|
||||||
|
|
||||||
def tagschanged(self, tags):
|
def tagschanged(self, tags):
|
||||||
__ = []
|
__ = []
|
||||||
|
@ -11,7 +11,12 @@ from PyQt5.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from webviewpy import webview_error_t, 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
|
||||||
@ -366,19 +371,12 @@ class Prompt_dialog(QDialog):
|
|||||||
hl.addWidget(QLabel(_[0]))
|
hl.addWidget(QLabel(_[0]))
|
||||||
hl.addWidget(le)
|
hl.addWidget(le)
|
||||||
_layout.addLayout(hl)
|
_layout.addLayout(hl)
|
||||||
button = QDialogButtonBox(QDialogButtonBox.Ok)
|
button = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
button.accepted.connect(self.accept)
|
button.accepted.connect(self.accept)
|
||||||
|
button.rejected.connect(self.reject)
|
||||||
_layout.addWidget(button)
|
_layout.addWidget(button)
|
||||||
self.setLayout(_layout)
|
self.setLayout(_layout)
|
||||||
self.resize(400, 1)
|
self.resize(400, 1)
|
||||||
cursor = QCursor()
|
|
||||||
pos = cursor.pos()
|
|
||||||
num_screens = QDesktopWidget().screenCount()
|
|
||||||
for i in range(num_screens):
|
|
||||||
_rect = QDesktopWidget().screenGeometry(i)
|
|
||||||
if isinrect(pos, [_rect.getRect()[_] for _ in [0, 2, 1, 3]]):
|
|
||||||
self.move(_rect.width() // 2 - self.width() // 2, _rect.height() // 3)
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
def callbackwrap(d, k, call, _):
|
def callbackwrap(d, k, call, _):
|
||||||
@ -545,14 +543,16 @@ class WebivewWidget(QWidget):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
class _Webview(Webview):
|
class _Webview(Webview):
|
||||||
def navigate(_, url: str) -> webview_error_t:
|
def navigate(_, url: str) -> webview_error_t:
|
||||||
self.on_load.emit(url)
|
self.on_load.emit(url)
|
||||||
return super().navigate(url)
|
return super().navigate(url)
|
||||||
|
|
||||||
self.webview = _Webview(debug=debug, window=int(self.winId()))
|
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])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user