mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -04:00
fix audio replay
This commit is contained in:
parent
59d3807c1c
commit
2dcb86e4ac
3 changed files with 17 additions and 17 deletions
|
@ -52,8 +52,7 @@ or your deck may have a problem.
|
|||
<p>To confirm it's not a problem with your deck, please run
|
||||
<b>Tools > Advanced > Check Database</b>.
|
||||
<p>If that doesn't fix the problem, please copy the following<br>
|
||||
into a bug report:<br>
|
||||
""")
|
||||
into a bug report:""")
|
||||
pluginText = _("""\
|
||||
An error occurred in a plugin. Please contact the plugin author.<br>
|
||||
Please do not file a bug report with Anki.<br>""")
|
||||
|
|
10
aqt/main.py
10
aqt/main.py
|
@ -12,7 +12,7 @@ from PyQt4 import pyqtconfig
|
|||
QtConfig = pyqtconfig.Configuration()
|
||||
|
||||
from anki import Deck
|
||||
from anki.sound import hasSound, playFromText, clearAudioQueue, stripSounds
|
||||
from anki.sound import playFromText, clearAudioQueue, stripSounds
|
||||
from anki.utils import addTags, parseTags, canonifyTags, stripHTML, \
|
||||
checksum, isWin, isMac
|
||||
from anki.hooks import runHook, addHook, removeHook
|
||||
|
@ -940,13 +940,7 @@ Please choose a new deck name:"""))
|
|||
##########################################################################
|
||||
|
||||
def onRepeatAudio(self):
|
||||
clearAudioQueue()
|
||||
if (not self.currentCard.cardModel.questionInAnswer
|
||||
or self.state == "showQuestion") and \
|
||||
self.config['repeatQuestionAudio']:
|
||||
playFromText(self.currentCard.question)
|
||||
if self.state != "showQuestion":
|
||||
playFromText(self.currentCard.answer)
|
||||
self.reviewer.replayAudio()
|
||||
|
||||
# Schema modifications
|
||||
##########################################################################
|
||||
|
|
|
@ -8,7 +8,7 @@ from PyQt4.QtCore import *
|
|||
from PyQt4.QtGui import *
|
||||
from anki.utils import fmtTimeSpan, stripHTML
|
||||
from anki.hooks import addHook, runHook, runFilter
|
||||
from anki.sound import playFromText, clearAudioQueue
|
||||
from anki.sound import playFromText, clearAudioQueue, hasSound
|
||||
from aqt.utils import mungeQA, getBase
|
||||
import aqt
|
||||
|
||||
|
@ -71,13 +71,20 @@ class Reviewer(object):
|
|||
else:
|
||||
self._showEmpty()
|
||||
|
||||
# Audio
|
||||
##########################################################################
|
||||
|
||||
def _maybeEnableSound(self):
|
||||
print "enable sound fixme"
|
||||
return
|
||||
snd = (hasSound(self.reviewer.card.q()) or
|
||||
(hasSound(self.reviewer.card.a()) and
|
||||
self.state != "getQuestion"))
|
||||
self.form.actionRepeatAudio.setEnabled(snd)
|
||||
self.mw.form.actionRepeatAudio.setEnabled(
|
||||
hasSound(self.card.q() + self.card.a()))
|
||||
|
||||
def replayAudio(self):
|
||||
clearAudioQueue()
|
||||
c = self.card
|
||||
if not c.template()['hideQ'] or self.state == "question":
|
||||
playFromText(c.q())
|
||||
if self.state == "answer":
|
||||
playFromText(c.a())
|
||||
|
||||
# Initializing the webview
|
||||
##########################################################################
|
||||
|
|
Loading…
Reference in a new issue