From 7054281bb8e89ff6eb446081b86f52bc54655062 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 27 Dec 2010 04:32:51 +0900 Subject: [PATCH] don't needlessly copy recorded audio --- ankiqt/ui/facteditor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index f37392e47..291286901 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -964,14 +964,17 @@ class FactEditor(object): return self._addSound(file, widget=w) - def _addSound(self, file, widget=None): + def _addSound(self, file, widget=None, copy=True): self.initMedia() if widget: w = widget else: w = self.focusedEdit() - path = self._addMedia(file) - self.maybeDelete(path, file) + if copy: + path = self._addMedia(file) + self.maybeDelete(path, file) + else: + path = file anki.sound.play(path) w.insertHtml('[sound:%s]' % path) @@ -998,7 +1001,7 @@ to enable recording.'''), parent=self.parent) return raise if file: - self._addSound(unicode(file), widget=w) + self._addSound(file, w, copy=False) class FactEdit(QTextEdit):