mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add perDay config option, more updates for libanki sched changes
- new review early / learn more handling - reset() when showing study stats - only run the update timer on study screen & finished screen
This commit is contained in:
parent
afba9529fe
commit
d698c3d310
4 changed files with 30 additions and 14 deletions
|
@ -63,6 +63,8 @@ class DeckProperties(QDialog):
|
|||
self.dialog.collapse.setCheckState(self.d.collapseTime
|
||||
and Qt.Checked or Qt.Unchecked)
|
||||
self.dialog.failedCardMax.setText(unicode(self.d.failedCardMax))
|
||||
self.dialog.perDay.setCheckState(self.d.getBool("perDay")
|
||||
and Qt.Checked or Qt.Unchecked)
|
||||
# sources
|
||||
self.sources = self.d.s.all("select id, name from sources")
|
||||
self.sourcesToRemove = []
|
||||
|
@ -266,6 +268,8 @@ class DeckProperties(QDialog):
|
|||
was = self.d.modified
|
||||
self.updateField(self.d, 'collapseTime',
|
||||
self.dialog.collapse.isChecked() and 1 or 0)
|
||||
if self.dialog.perDay.isChecked() != self.d.getBool("perDay"):
|
||||
self.d.setVar('perDay', self.dialog.perDay.isChecked())
|
||||
self.updateField(self.d,
|
||||
"highPriority",
|
||||
unicode(self.dialog.highPriority.text()))
|
||||
|
|
|
@ -329,7 +329,7 @@ Please do not file a bug report with Anki.<br>""")
|
|||
if self.deck.isEmpty():
|
||||
return self.moveToState("deckEmpty")
|
||||
else:
|
||||
if not self.deck.reviewEarly:
|
||||
if not self.deck.finishScheduler:
|
||||
if (self.config['showStudyScreen'] and
|
||||
not self.deck.sessionStartTime):
|
||||
return self.moveToState("studyScreen")
|
||||
|
@ -390,7 +390,8 @@ Please do not file a bug report with Anki.<br>""")
|
|||
return self.moveToState("showQuestion")
|
||||
elif state == "studyScreen":
|
||||
self.currentCard = None
|
||||
self.deck.resetAfterReviewEarly()
|
||||
if self.deck.finishScheduler:
|
||||
self.deck.finishScheduler()
|
||||
self.disableCardMenuItems()
|
||||
self.showStudyScreen()
|
||||
self.updateViews(state)
|
||||
|
@ -841,8 +842,8 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
|||
self.closeAllDeckWindows()
|
||||
synced = False
|
||||
if self.deck is not None:
|
||||
if self.deck.reviewEarly:
|
||||
self.deck.resetAfterReviewEarly()
|
||||
if self.deck.finishScheduler:
|
||||
self.deck.finishScheduler()
|
||||
# update counts
|
||||
for d in self.browserDecks:
|
||||
if d['path'] == self.deck.path:
|
||||
|
@ -1531,6 +1532,7 @@ later by using File>Close.
|
|||
uf(self.deck, 'newCardOrder', ncOrd)
|
||||
|
||||
def updateStudyStats(self):
|
||||
self.deck.reset()
|
||||
wasReached = self.deck.sessionLimitReached()
|
||||
sessionColour = '<font color=#0000ff>%s</font>'
|
||||
cardColour = '<font color=#0000ff>%s</font>'
|
||||
|
@ -2065,13 +2067,13 @@ it to your friends.
|
|||
##########################################################################
|
||||
|
||||
def onLearnMore(self):
|
||||
self.deck.newEarly = True
|
||||
self.deck.setupLearnMoreScheduler()
|
||||
self.reset()
|
||||
self.showToolTip(_("""\
|
||||
<h1>Learning More</h1>Click the stopwatch at the top to finish."""))
|
||||
|
||||
def onReviewEarly(self):
|
||||
self.deck.reviewEarly = True
|
||||
self.deck.setupReviewEarlyScheduler()
|
||||
self.reset()
|
||||
self.showToolTip(_("""\
|
||||
<h1>Reviewing Early</h1>Click the stopwatch at the top to finish."""))
|
||||
|
|
|
@ -164,8 +164,6 @@ class StatusView(object):
|
|||
remStr += "<b>0</b>"
|
||||
elif self.state == "deckEmpty":
|
||||
remStr += "<b>0</b>"
|
||||
elif self.main.deck.reviewEarly:
|
||||
remStr += "<b>0</b>"
|
||||
else:
|
||||
# remaining string, bolded depending on current card
|
||||
if sys.platform.startswith("linux"):
|
||||
|
@ -187,10 +185,7 @@ class StatusView(object):
|
|||
"<u>%(new1)s</u>")
|
||||
stats['failed1'] = '<font color=#990000>%s</font>' % stats['failed']
|
||||
stats['rev1'] = '<font color=#000000>%s</font>' % stats['rev']
|
||||
if self.main.deck.newEarly:
|
||||
new = self.main.deck.newCount
|
||||
else:
|
||||
new = stats['new']
|
||||
new = stats['new']
|
||||
stats['new1'] = '<font color=#0000ff>%s</font>' % new
|
||||
self.remText.setText(remStr % stats)
|
||||
stats['spaced'] = self.main.deck.spacedCardCount()
|
||||
|
@ -287,7 +282,7 @@ You should aim to answer each question within<br>
|
|||
|
||||
def flashTimer(self):
|
||||
if not (self.main.deck.sessionStartTime and
|
||||
self.main.deck.sessionTimeLimit) or self.main.deck.reviewEarly:
|
||||
self.main.deck.sessionTimeLimit): # or self.main.deck.reviewEarly:
|
||||
return
|
||||
t = time.time() - self.main.deck.sessionStartTime
|
||||
t = self.main.deck.sessionTimeLimit - t
|
||||
|
@ -302,7 +297,7 @@ You should aim to answer each question within<br>
|
|||
return
|
||||
if not self.main.deck:
|
||||
return
|
||||
if self.state in ("showQuestion", "showAnswer", "studyScreen"):
|
||||
if self.state in ("deckFinished", "studyScreen"):
|
||||
self.main.deck.reset()
|
||||
self.redraw()
|
||||
self.main.updateTitleBar()
|
||||
|
|
|
@ -589,6 +589,20 @@
|
|||
<item row="5" column="2">
|
||||
<widget class="QSpinBox" name="leechFails"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><b>Per-day scheduling</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QCheckBox" name="perDay">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -648,6 +662,7 @@
|
|||
<tabstop>timeOffset</tabstop>
|
||||
<tabstop>suspendLeeches</tabstop>
|
||||
<tabstop>leechFails</tabstop>
|
||||
<tabstop>perDay</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in a new issue