diff --git a/ankiqt/ui/addcards.py b/ankiqt/ui/addcards.py index 358d7f41c..ccbfbb6ee 100644 --- a/ankiqt/ui/addcards.py +++ b/ankiqt/ui/addcards.py @@ -11,6 +11,7 @@ from anki.errors import * from anki.utils import stripHTML, parseTags from ankiqt.ui.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter from ankiqt import ui +from anki.sound import clearAudioQueue class AddCards(QDialog): @@ -114,6 +115,8 @@ question or answer on all cards."""), parent=self) # we're guaranteed that all fields will exist now "str": stripHTML(fact[fact.fields[0].name]), }) + # stop anything playing + clearAudioQueue() self.parent.deck.setUndoEnd(n) self.parent.updateTitleBar() # start a new fact @@ -135,6 +138,8 @@ question or answer on all cards."""), parent=self) QDialog.reject(self) def onClose(self): + # stop anything playing + clearAudioQueue() if (self.editor.fieldsAreBlank() or ui.utils.askUser(_("Close and lose current input?"), self)): diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index c2fe000a9..88b6eab80 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -13,7 +13,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from anki import DeckStorage from anki.errors import * -from anki.sound import hasSound, playFromText +from anki.sound import hasSound, playFromText, clearAudioQueue from anki.utils import addTags, deleteTags, parseTags from anki.media import rebuildMediaDir from anki.db import OperationalError @@ -327,6 +327,8 @@ Please do not file a bug report with Anki.\n\n""") stats = self.deck.getStats() if stats['gTotal'] % num == 0: self.onSave() + # stop anything playing + clearAudioQueue() self.moveToState("getQuestion") def startRefreshTimer(self):