diff --git a/aqt/errors.py b/aqt/errors.py index 9a1767f1b..0f01c311e 100644 --- a/aqt/errors.py +++ b/aqt/errors.py @@ -52,8 +52,7 @@ or your deck may have a problem.
To confirm it's not a problem with your deck, please run Tools > Advanced > Check Database.
If that doesn't fix the problem, please copy the following
-into a bug report:
-""")
+into a bug report:""")
pluginText = _("""\
An error occurred in a plugin. Please contact the plugin author.
Please do not file a bug report with Anki.
""")
diff --git a/aqt/main.py b/aqt/main.py
index 22ed6e18b..6fe4565f4 100755
--- a/aqt/main.py
+++ b/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
##########################################################################
diff --git a/aqt/reviewer.py b/aqt/reviewer.py
index 82b82635e..cfcefb30e 100644
--- a/aqt/reviewer.py
+++ b/aqt/reviewer.py
@@ -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
##########################################################################