From f9a0bc6b6c5d878d5ec76ce6633dd1c1fd7414aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?=
<101191390+HIllya51@users.noreply.github.com>
Date: Fri, 24 May 2024 23:55:06 +0800
Subject: [PATCH] =?UTF-8?q?Revert=20"anki=E8=87=AA=E5=8A=A8=E5=9C=A8?=
=?UTF-8?q?=E4=BE=8B=E5=8F=A5=E4=B8=AD=E5=8A=A0=E7=B2=97=E5=8E=9F=E5=8D=95?=
=?UTF-8?q?=E8=AF=8D=20(#765)"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 0d033e1b3d27f4c6bbc82c6ef89a57fac7b453be.
---
LunaTranslator/LunaTranslator/gui/showword.py | 16 +++++-----------
.../LunaTranslator/gui/translatorUI.py | 3 +--
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py
index ab779200..bcb351f5 100644
--- a/LunaTranslator/LunaTranslator/gui/showword.py
+++ b/LunaTranslator/LunaTranslator/gui/showword.py
@@ -149,11 +149,8 @@ class AnkiWindow(QWidget):
def langdu2(self):
if gobject.baseobject.reader:
- example_text = self.example.toPlainText()
- example_text = example_text.replace("", "")
- example_text = example_text.replace("", "")
gobject.baseobject.reader.ttscallback(
- example_text,
+ self.example.toPlainText(),
functools.partial(self.callbacktts, self.audiopath_sentence),
)
@@ -740,7 +737,7 @@ class selectviewer(QWidget):
class searchwordW(closeashidewindow):
- getnewsentencesignal = pyqtSignal(str, str, bool)
+ getnewsentencesignal = pyqtSignal(str, bool)
showtabsignal = pyqtSignal(float, str, str)
def __init__(self, parent):
@@ -849,19 +846,16 @@ class searchwordW(closeashidewindow):
res.insert(idx, {"source": k, "content": v})
return res
- def getnewsentence(self, sentence, sentence_trans, append):
+ def getnewsentence(self, sentence, append):
sentence = sentence.strip()
- sentence_trans = sentence_trans.strip()
self.showNormal()
if append:
sentence = self.searchtext.text() + sentence
self.searchtext.setText(sentence)
self.search(sentence)
- example_text = gobject.baseobject.currenttext
- if sentence_trans in example_text:
- example_text = example_text.replace(sentence_trans, f"{sentence_trans}")
- self.ankiwindow.example.setPlainText(example_text)
+
+ self.ankiwindow.example.setPlainText(gobject.baseobject.currenttext)
if globalconfig["ankiconnect"]["autoruntts"]:
self.ankiwindow.langdu()
if globalconfig["ankiconnect"]["autoruntts2"]:
diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py
index 5d33cf3f..47e656ca 100644
--- a/LunaTranslator/LunaTranslator/gui/translatorUI.py
+++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py
@@ -238,7 +238,6 @@ class QUnFrameWindow(resizableframeless):
if hira:
def callback(word, append):
- word_in_sentence = word["orig"]
if globalconfig["usewordorigin"] == False:
word = word["orig"]
else:
@@ -253,7 +252,7 @@ class QUnFrameWindow(resizableframeless):
winsharedutils.clipboard_set(word)
if globalconfig["usesearchword"]:
gobject.baseobject.searchwordW.getnewsentencesignal.emit(
- word, word_in_sentence, append
+ word, append
)
self.translate_text.addsearchwordmask(hira, text, callback)