mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
clear audio queue when changing cards/editing
This commit is contained in:
parent
aac727f2b5
commit
39d59d4d99
2 changed files with 8 additions and 1 deletions
|
@ -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)):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue