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
|
<p>To confirm it's not a problem with your deck, please run
|
||||||
<b>Tools > Advanced > Check Database</b>.
|
<b>Tools > Advanced > Check Database</b>.
|
||||||
<p>If that doesn't fix the problem, please copy the following<br>
|
<p>If that doesn't fix the problem, please copy the following<br>
|
||||||
into a bug report:<br>
|
into a bug report:""")
|
||||||
""")
|
|
||||||
pluginText = _("""\
|
pluginText = _("""\
|
||||||
An error occurred in a plugin. Please contact the plugin author.<br>
|
An error occurred in a plugin. Please contact the plugin author.<br>
|
||||||
Please do not file a bug report with Anki.<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()
|
QtConfig = pyqtconfig.Configuration()
|
||||||
|
|
||||||
from anki import Deck
|
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, \
|
from anki.utils import addTags, parseTags, canonifyTags, stripHTML, \
|
||||||
checksum, isWin, isMac
|
checksum, isWin, isMac
|
||||||
from anki.hooks import runHook, addHook, removeHook
|
from anki.hooks import runHook, addHook, removeHook
|
||||||
|
@ -940,13 +940,7 @@ Please choose a new deck name:"""))
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def onRepeatAudio(self):
|
def onRepeatAudio(self):
|
||||||
clearAudioQueue()
|
self.reviewer.replayAudio()
|
||||||
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)
|
|
||||||
|
|
||||||
# Schema modifications
|
# Schema modifications
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
|
@ -8,7 +8,7 @@ from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
from anki.utils import fmtTimeSpan, stripHTML
|
from anki.utils import fmtTimeSpan, stripHTML
|
||||||
from anki.hooks import addHook, runHook, runFilter
|
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
|
from aqt.utils import mungeQA, getBase
|
||||||
import aqt
|
import aqt
|
||||||
|
|
||||||
|
@ -71,13 +71,20 @@ class Reviewer(object):
|
||||||
else:
|
else:
|
||||||
self._showEmpty()
|
self._showEmpty()
|
||||||
|
|
||||||
|
# Audio
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
def _maybeEnableSound(self):
|
def _maybeEnableSound(self):
|
||||||
print "enable sound fixme"
|
self.mw.form.actionRepeatAudio.setEnabled(
|
||||||
return
|
hasSound(self.card.q() + self.card.a()))
|
||||||
snd = (hasSound(self.reviewer.card.q()) or
|
|
||||||
(hasSound(self.reviewer.card.a()) and
|
def replayAudio(self):
|
||||||
self.state != "getQuestion"))
|
clearAudioQueue()
|
||||||
self.form.actionRepeatAudio.setEnabled(snd)
|
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
|
# Initializing the webview
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue