mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 07:07:13 -05:00
play audio once for each template, not once on open
This commit is contained in:
parent
94311153c8
commit
f01d1f9142
1 changed files with 4 additions and 13 deletions
|
|
@ -99,7 +99,7 @@ class CardLayout(QDialog):
|
|||
def setupCards(self):
|
||||
self.needFormatRebuild = False
|
||||
self.updatingCards = False
|
||||
self.playedAudio = False
|
||||
self.playedAudio = {}
|
||||
# replace with more appropriate size hints
|
||||
for e in ("cardQuestion", "cardAnswer"):
|
||||
w = getattr(self.form, e)
|
||||
|
|
@ -274,16 +274,7 @@ order by n""", id=card.id)
|
|||
self.saveCard()
|
||||
|
||||
def renderPreview(self):
|
||||
if self.card:
|
||||
c = self.card
|
||||
else:
|
||||
# we'll need to generate one
|
||||
cards = self.deck.previewFact(self.fact)
|
||||
if not cards:
|
||||
ui.utils.showInfo(_("No cards to preview."),
|
||||
parent=parent)
|
||||
return
|
||||
pass
|
||||
c = self.card
|
||||
styles = (self.deck.rebuildCSS() +
|
||||
("\nhtml { background: %s }" % c.cardModel.lastFontColour))
|
||||
styles = runFilter("addStyles", styles, c)
|
||||
|
|
@ -297,10 +288,10 @@ order by n""", id=card.id)
|
|||
c)
|
||||
+ "</body></html>")
|
||||
clearAudioQueue()
|
||||
if not self.playedAudio:
|
||||
if c.id not in self.playedAudio:
|
||||
playFromText(c.question)
|
||||
playFromText(c.answer)
|
||||
self.playedAudio = True
|
||||
self.playedAudio[c.id] = True
|
||||
|
||||
def reject(self):
|
||||
modified = False
|
||||
|
|
|
|||
Loading…
Reference in a new issue