don't needlessly copy recorded audio

This commit is contained in:
Damien Elmes 2010-12-27 04:32:51 +09:00
parent b6665230d1
commit 7054281bb8

View file

@ -964,14 +964,17 @@ class FactEditor(object):
return return
self._addSound(file, widget=w) self._addSound(file, widget=w)
def _addSound(self, file, widget=None): def _addSound(self, file, widget=None, copy=True):
self.initMedia() self.initMedia()
if widget: if widget:
w = widget w = widget
else: else:
w = self.focusedEdit() w = self.focusedEdit()
path = self._addMedia(file) if copy:
self.maybeDelete(path, file) path = self._addMedia(file)
self.maybeDelete(path, file)
else:
path = file
anki.sound.play(path) anki.sound.play(path)
w.insertHtml('[sound:%s]' % path) w.insertHtml('[sound:%s]' % path)
@ -998,7 +1001,7 @@ to enable recording.'''), parent=self.parent)
return return
raise raise
if file: if file:
self._addSound(unicode(file), widget=w) self._addSound(file, w, copy=False)
class FactEdit(QTextEdit): class FactEdit(QTextEdit):