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

View file

@ -97,10 +97,12 @@ class Reviewer(object):
playFromText(c.q())
elif self.state == "answer":
txt = ""
if self.mw.col.conf.get("replayBoth", True):
exclude = c.q()
if self._replayq(c):
txt = c.q()
exclude = ""
txt += c.a()
playFromText(txt)
playFromText(txt, exclude)
# 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(
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):
self.web.eval("_toggleStar(%s);" % json.dumps(
self.card.note().hasTag("marked")))

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>438</height>
<width>481</width>
<height>401</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -556,6 +556,16 @@
</property>
</widget>
</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>
<spacer name="verticalSpacer_5">
<property name="orientation">
@ -626,6 +636,7 @@
<tabstop>maxTaken</tabstop>
<tabstop>showTimer</tabstop>
<tabstop>autoplaySounds</tabstop>
<tabstop>replayQuestion</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>desc</tabstop>
</tabstops>