diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index 243053e7..c23d520c 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -119,6 +119,7 @@ class AnkiWindow(QDialog): } ) media = [] + tempfiles=[] for k, _ in [("audio", self.audiofile), ("image", self.cropedimagepath)]: if _: media.append( @@ -130,6 +131,7 @@ class AnkiWindow(QDialog): } ] ) + tempfiles.append(_) else: media.append([]) @@ -145,7 +147,11 @@ class AnkiWindow(QDialog): media[0], media[1], ) - + for _ in tempfiles: + try: + os.remove(_) + except: + pass class searchwordW(closeashidewindow): getnewsentencesignal = pyqtSignal(str, bool) diff --git a/LunaTranslator/LunaTranslator/myutils/ankiconnect_config.py b/LunaTranslator/LunaTranslator/myutils/ankiconnect_config.py index fb43e4a2..1bdd105f 100644 --- a/LunaTranslator/LunaTranslator/myutils/ankiconnect_config.py +++ b/LunaTranslator/LunaTranslator/myutils/ankiconnect_config.py @@ -15,6 +15,7 @@ model_htmlfront = """ {{explain}}
{{image}} +
{{audio}}
""" model_htmlback = """ {{word}} @@ -22,4 +23,5 @@ model_htmlback = """ {{explain}}
{{image}} +
{{audio}}
""" diff --git a/LunaTranslator/LunaTranslator/tts/basettsclass.py b/LunaTranslator/LunaTranslator/tts/basettsclass.py index 9a162e2d..c0b69ef9 100644 --- a/LunaTranslator/LunaTranslator/tts/basettsclass.py +++ b/LunaTranslator/LunaTranslator/tts/basettsclass.py @@ -1,5 +1,5 @@ from myutils.config import globalconfig -import threading +import threading, os class TTSbase: @@ -71,4 +71,4 @@ class TTSbase: voice = globalconfig["reader"][self.typename]["voice"] voice_index = self.voicelist.index(voice) fname = self.speak(content, rate, voice, voice_index) - return fname + return os.path.abspath(fname)