mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
append
This commit is contained in:
parent
9b7cc6b173
commit
1a23b76c83
@ -18,7 +18,7 @@ from gui.usefulwidget import closeashidewindow
|
|||||||
|
|
||||||
|
|
||||||
class searchwordW(closeashidewindow):
|
class searchwordW(closeashidewindow):
|
||||||
getnewsentencesignal = pyqtSignal(str)
|
getnewsentencesignal = pyqtSignal(str, bool)
|
||||||
searchthreadsignal = pyqtSignal(str, dict, str)
|
searchthreadsignal = pyqtSignal(str, dict, str)
|
||||||
showtabsignal = pyqtSignal(str, str)
|
showtabsignal = pyqtSignal(str, str)
|
||||||
|
|
||||||
@ -104,8 +104,10 @@ class searchwordW(closeashidewindow):
|
|||||||
if gobject.baseobject.reader:
|
if gobject.baseobject.reader:
|
||||||
gobject.baseobject.reader.read(self.searchtext.text(), True)
|
gobject.baseobject.reader.read(self.searchtext.text(), True)
|
||||||
|
|
||||||
def getnewsentence(self, sentence):
|
def getnewsentence(self, sentence, append):
|
||||||
self.showNormal()
|
self.showNormal()
|
||||||
|
if append:
|
||||||
|
sentence = self.searchtext.text() + sentence
|
||||||
self.searchtext.setText(sentence)
|
self.searchtext.setText(sentence)
|
||||||
|
|
||||||
self.search(sentence)
|
self.search(sentence)
|
||||||
|
@ -6,6 +6,7 @@ from PyQt5.QtGui import (
|
|||||||
QTextCursor,
|
QTextCursor,
|
||||||
QPixmap,
|
QPixmap,
|
||||||
QFontMetricsF,
|
QFontMetricsF,
|
||||||
|
QMouseEvent,
|
||||||
)
|
)
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QTextBrowser,
|
QTextBrowser,
|
||||||
@ -36,18 +37,21 @@ class Qlabel_c(QLabel):
|
|||||||
pass
|
pass
|
||||||
# return super().mouseMoveEvent(ev)
|
# return super().mouseMoveEvent(ev)
|
||||||
|
|
||||||
def mouseReleaseEvent(self, ev):
|
def mouseReleaseEvent(self, event: QMouseEvent):
|
||||||
try:
|
try:
|
||||||
if self.underMouse():
|
if self.underMouse():
|
||||||
try:
|
try:
|
||||||
if self.pr:
|
if self.pr:
|
||||||
self.callback()
|
if event.button() == Qt.RightButton:
|
||||||
|
self.callback(True)
|
||||||
|
else:
|
||||||
|
self.callback(False)
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
self.pr = False
|
self.pr = False
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
return super().mouseReleaseEvent(ev)
|
return super().mouseReleaseEvent(event)
|
||||||
|
|
||||||
def enterEvent(self, a0) -> None:
|
def enterEvent(self, a0) -> None:
|
||||||
if self.company:
|
if self.company:
|
||||||
|
@ -255,7 +255,7 @@ class QUnFrameWindow(resizableframeless):
|
|||||||
|
|
||||||
if hira:
|
if hira:
|
||||||
|
|
||||||
def callback(word):
|
def callback(word, append):
|
||||||
if globalconfig["usewordorigin"] == False:
|
if globalconfig["usewordorigin"] == False:
|
||||||
word = word["orig"]
|
word = word["orig"]
|
||||||
else:
|
else:
|
||||||
@ -264,7 +264,9 @@ class QUnFrameWindow(resizableframeless):
|
|||||||
if globalconfig["usecopyword"]:
|
if globalconfig["usecopyword"]:
|
||||||
winsharedutils.clipboard_set(word)
|
winsharedutils.clipboard_set(word)
|
||||||
if globalconfig["usesearchword"]:
|
if globalconfig["usesearchword"]:
|
||||||
gobject.baseobject.searchwordW.getnewsentencesignal.emit(word)
|
gobject.baseobject.searchwordW.getnewsentencesignal.emit(
|
||||||
|
word, append
|
||||||
|
)
|
||||||
|
|
||||||
self.translate_text.addsearchwordmask(hira, text, callback)
|
self.translate_text.addsearchwordmask(hira, text, callback)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user