From eda4c303bad5fb7a6e4429b298858b3dfb8b3cb1 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: Wed, 15 May 2024 02:00:20 +0800
Subject: [PATCH] fix
---
LunaTranslator/LunaTranslator/gui/showword.py | 8 +++++++-
.../LunaTranslator/myutils/ankiconnect_config.py | 2 ++
LunaTranslator/LunaTranslator/tts/basettsclass.py | 4 ++--
3 files changed, 11 insertions(+), 3 deletions(-)
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}}
+