deck option to replay answer only

This commit is contained in:
Damien Elmes 2012-07-04 18:20:11 +09:00
parent 3cd66f000f
commit c74e955615
3 changed files with 23 additions and 4 deletions

View file

@ -187,6 +187,7 @@ class DeckConf(QDialog):
f.maxTaken.setValue(c['maxTaken']) f.maxTaken.setValue(c['maxTaken'])
f.showTimer.setChecked(c.get('timer', 0)) f.showTimer.setChecked(c.get('timer', 0))
f.autoplaySounds.setChecked(c['autoplay']) f.autoplaySounds.setChecked(c['autoplay'])
f.replayQuestion.setChecked(c.get('replayq', True))
# description # description
f.desc.setPlainText(self.deck['desc']) f.desc.setPlainText(self.deck['desc'])
@ -262,6 +263,7 @@ class DeckConf(QDialog):
c['maxTaken'] = f.maxTaken.value() c['maxTaken'] = f.maxTaken.value()
c['timer'] = f.showTimer.isChecked() and 1 or 0 c['timer'] = f.showTimer.isChecked() and 1 or 0
c['autoplay'] = f.autoplaySounds.isChecked() c['autoplay'] = f.autoplaySounds.isChecked()
c['replayq'] = f.replayQuestion.isChecked()
# description # description
self.deck['desc'] = f.desc.toPlainText() self.deck['desc'] = f.desc.toPlainText()
self.mw.col.decks.save(self.deck) self.mw.col.decks.save(self.deck)

View file

@ -97,10 +97,12 @@ class Reviewer(object):
playFromText(c.q()) playFromText(c.q())
elif self.state == "answer": elif self.state == "answer":
txt = "" txt = ""
if self.mw.col.conf.get("replayBoth", True): exclude = c.q()
if self._replayq(c):
txt = c.q() txt = c.q()
exclude = ""
txt += c.a() txt += c.a()
playFromText(txt) playFromText(txt, exclude)
# Initializing the webview # Initializing the webview
########################################################################## ##########################################################################
@ -200,6 +202,10 @@ The front of this card is empty. Please run Tools>Maintenance>Empty Cards.""")
return self.mw.col.decks.confForDid( return self.mw.col.decks.confForDid(
self.card.odid or self.card.did)['autoplay'] self.card.odid or self.card.did)['autoplay']
def _replayq(self, card):
return self.mw.col.decks.confForDid(
self.card.odid or self.card.did).get('replayq', True)
def _toggleStar(self): def _toggleStar(self):
self.web.eval("_toggleStar(%s);" % json.dumps( self.web.eval("_toggleStar(%s);" % json.dumps(
self.card.note().hasTag("marked"))) self.card.note().hasTag("marked")))

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>481</width>
<height>438</height> <height>401</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -556,6 +556,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="replayQuestion">
<property name="text">
<string>When answer shown, replay both question and answer audio</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
@ -626,6 +636,7 @@
<tabstop>maxTaken</tabstop> <tabstop>maxTaken</tabstop>
<tabstop>showTimer</tabstop> <tabstop>showTimer</tabstop>
<tabstop>autoplaySounds</tabstop> <tabstop>autoplaySounds</tabstop>
<tabstop>replayQuestion</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
<tabstop>desc</tabstop> <tabstop>desc</tabstop>
</tabstops> </tabstops>