add option to show day learn cards before reviews

This commit is contained in:
Damien Elmes 2018-01-20 16:07:41 +10:00
parent b17a0552d0
commit d3d61ce93f
4 changed files with 29 additions and 8 deletions

View file

@ -45,6 +45,7 @@ defaultConf = {
'sortType': "noteFld", 'sortType': "noteFld",
'sortBackwards': False, 'sortBackwards': False,
'addToCur': True, # add new to currently selected deck? 'addToCur': True, # add new to currently selected deck?
'dayLearnFirst': False,
} }
# this is initialized by storage.Collection # this is initialized by storage.Collection

View file

@ -304,23 +304,34 @@ order by due""" % self._deckLimit(),
c = self._getLrnCard() c = self._getLrnCard()
if c: if c:
return c return c
# new first, or time for one? # new first, or time for one?
if self._timeForNewCard(): if self._timeForNewCard():
c = self._getNewCard() c = self._getNewCard()
if c: if c:
return c return c
# day learning first and card due?
dayLearnFirst = self.col.conf.get("dayLearnFirst", False)
c = dayLearnFirst and self._getLrnDayCard()
if c:
return c
# card due for review? # card due for review?
c = self._getRevCard() c = self._getRevCard()
if c: if c:
return c return c
# day learning card due? # day learning card due?
c = self._getLrnDayCard() c = not dayLearnFirst and self._getLrnDayCard()
if c: if c:
return c return c
# new cards left? # new cards left?
c = self._getNewCard() c = self._getNewCard()
if c: if c:
return c return c
# collapse or finish # collapse or finish
return self._getLrnCard(collapse=True) return self._getLrnCard(collapse=True)

View file

@ -83,8 +83,9 @@ class Preferences(QDialog):
f.newSpread.addItems(list(c.newCardSchedulingLabels().values())) f.newSpread.addItems(list(c.newCardSchedulingLabels().values()))
f.newSpread.setCurrentIndex(qc['newSpread']) f.newSpread.setCurrentIndex(qc['newSpread'])
f.useCurrent.setCurrentIndex(int(not qc.get("addToCur", True))) f.useCurrent.setCurrentIndex(int(not qc.get("addToCur", True)))
f.dayLearnFirst.setChecked(qc.get("dayLearnFirst", False))
if self.mw.col.schedVer() != 2:
self.dayLearnFirst.setVisible(False)
def updateCollection(self): def updateCollection(self):
f = self.form f = self.form
@ -97,6 +98,7 @@ class Preferences(QDialog):
qc['timeLim'] = f.timeLimit.value()*60 qc['timeLim'] = f.timeLimit.value()*60
qc['collapseTime'] = f.lrnCutoff.value()*60 qc['collapseTime'] = f.lrnCutoff.value()*60
qc['addToCur'] = not f.useCurrent.currentIndex() qc['addToCur'] = not f.useCurrent.currentIndex()
qc['dayLearnFirst'] = f.dayLearnFirst.isChecked()
self._updateDayCutoff() self._updateDayCutoff()
d.setMod() d.setMod()
@ -109,7 +111,6 @@ class Preferences(QDialog):
else: else:
self._setupDayCutoffV1() self._setupDayCutoffV1()
def _setupDayCutoffV1(self): def _setupDayCutoffV1(self):
self.startDate = datetime.datetime.fromtimestamp(self.mw.col.crt) self.startDate = datetime.datetime.fromtimestamp(self.mw.col.crt)
self.form.dayOffset.setValue(self.startDate.hour) self.form.dayOffset.setValue(self.startDate.hour)

View file

@ -85,6 +85,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="dayLearnFirst">
<property name="text">
<string>Show learning cards with larger steps before reviews</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QComboBox" name="useCurrent"> <widget class="QComboBox" name="useCurrent">
<item> <item>
@ -437,18 +444,19 @@
<tabstop>showProgress</tabstop> <tabstop>showProgress</tabstop>
<tabstop>pastePNG</tabstop> <tabstop>pastePNG</tabstop>
<tabstop>nightMode</tabstop> <tabstop>nightMode</tabstop>
<tabstop>dayLearnFirst</tabstop>
<tabstop>useCurrent</tabstop> <tabstop>useCurrent</tabstop>
<tabstop>newSpread</tabstop> <tabstop>newSpread</tabstop>
<tabstop>dayOffset</tabstop> <tabstop>dayOffset</tabstop>
<tabstop>lrnCutoff</tabstop> <tabstop>lrnCutoff</tabstop>
<tabstop>timeLimit</tabstop> <tabstop>timeLimit</tabstop>
<tabstop>syncMedia</tabstop>
<tabstop>syncOnProgramOpen</tabstop>
<tabstop>syncDeauth</tabstop>
<tabstop>numBackups</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
<tabstop>numBackups</tabstop>
<tabstop>syncOnProgramOpen</tabstop>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>fullSync</tabstop> <tabstop>fullSync</tabstop>
<tabstop>syncMedia</tabstop>
<tabstop>syncDeauth</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>