mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add timer flag, limit timer to maxTaken
This commit is contained in:
parent
494b7310f0
commit
34b56b5003
3 changed files with 21 additions and 2 deletions
|
@ -146,6 +146,7 @@ class DeckConf(QDialog):
|
|||
# general
|
||||
c = self.conf
|
||||
f.maxTaken.setValue(c['maxTaken'])
|
||||
f.showTimer.setChecked(c.get('timer', 0))
|
||||
f.autoplaySounds.setChecked(c['autoplay'])
|
||||
# description
|
||||
f.desc.setPlainText(self.deck['desc'])
|
||||
|
@ -216,6 +217,7 @@ class DeckConf(QDialog):
|
|||
# general
|
||||
c = self.conf
|
||||
c['maxTaken'] = f.maxTaken.value()
|
||||
c['timer'] = f.showTimer.isChecked() and 1 or 0
|
||||
c['autoplay'] = f.autoplaySounds.isChecked()
|
||||
# description
|
||||
self.deck['desc'] = f.desc.toPlainText()
|
||||
|
|
|
@ -352,6 +352,10 @@ td { font-weight: bold; font-size: 12px; }
|
|||
"""
|
||||
|
||||
def _bottomHTML(self, middle):
|
||||
if not self.card.deckConf().get('timer'):
|
||||
maxTime = 0
|
||||
else:
|
||||
maxTime = self.card.deckConf()['maxTaken']
|
||||
return """
|
||||
<table width=100%% cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
|
@ -376,7 +380,10 @@ setInterval(function () { time += 1; updateTime() }, 1000);
|
|||
});
|
||||
|
||||
var updateTime = function () {
|
||||
return;
|
||||
if (!%(maxTime)s) {
|
||||
return;
|
||||
}
|
||||
time = Math.min(%(maxTime)s, time);
|
||||
var m = Math.floor(time / 60);
|
||||
var s = time %% 60;
|
||||
if (s < 10) {
|
||||
|
@ -387,7 +394,8 @@ var updateTime = function () {
|
|||
}
|
||||
</script>
|
||||
""" % dict(middle=middle, rem=self._remaining(), edit=_("Edit"),
|
||||
more=_("More"), time=self.card.timeTaken()/1000)
|
||||
more=_("More"), time=self.card.timeTaken()/1000,
|
||||
maxTime=maxTime)
|
||||
|
||||
def _showAnswerButton(self):
|
||||
self.bottom.web.setFocus()
|
||||
|
|
|
@ -554,6 +554,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showTimer">
|
||||
<property name="text">
|
||||
<string>Show answer timer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoplaySounds">
|
||||
<property name="text">
|
||||
|
@ -631,8 +638,10 @@
|
|||
<tabstop>leechThreshold</tabstop>
|
||||
<tabstop>leechAction</tabstop>
|
||||
<tabstop>maxTaken</tabstop>
|
||||
<tabstop>showTimer</tabstop>
|
||||
<tabstop>autoplaySounds</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>desc</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
|
|
Loading…
Reference in a new issue