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