mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
study more option when daily limits reached
This commit is contained in:
parent
a134338f5a
commit
2bb2a4f412
2 changed files with 171 additions and 0 deletions
|
@ -55,6 +55,8 @@ class Overview(object):
|
|||
self.mw.moveToState("deckBrowser")
|
||||
elif url == "review":
|
||||
openLink(aqt.appShared+"info/%s?v=%s"%(self.sid, self.sidVer))
|
||||
elif url == "limits":
|
||||
self.onLimits()
|
||||
|
||||
def _keyHandler(self, evt):
|
||||
cram = self.mw.col.decks.current()['dyn']
|
||||
|
@ -69,6 +71,8 @@ class Overview(object):
|
|||
if key == "e" and cram:
|
||||
self.mw.col.sched.remDyn(self.mw.col.decks.selected())
|
||||
self.mw.reset()
|
||||
if key == "l":
|
||||
self.onLimits()
|
||||
|
||||
# HTML
|
||||
############################################################
|
||||
|
@ -186,6 +190,10 @@ text-align: center;
|
|||
links.append(["R", "refresh", _("Rebuild")])
|
||||
links.append(["E", "empty", _("Empty")])
|
||||
else:
|
||||
if not sum(self.mw.col.sched.counts()):
|
||||
if self.mw.col.sched.newDue() or \
|
||||
self.mw.col.sched.revDue():
|
||||
links.append(["L", "limits", _("Study More")])
|
||||
links.append(["C", "cram", _("Filter/Cram")])
|
||||
buf = ""
|
||||
for b in links:
|
||||
|
@ -196,3 +204,23 @@ text-align: center;
|
|||
self.bottom.draw(buf)
|
||||
self.bottom.web.setFixedHeight(isMac and 28 or 36)
|
||||
self.bottom.web.setLinkHandler(self._linkHandler)
|
||||
|
||||
# Today's limits
|
||||
######################################################################
|
||||
|
||||
def onLimits(self):
|
||||
d = QDialog(self.mw)
|
||||
frm = aqt.forms.limits.Ui_Dialog()
|
||||
frm.setupUi(d)
|
||||
deck = self.mw.col.decks.current()
|
||||
frm.newToday.setValue(deck.get('extendNew', 10))
|
||||
frm.revToday.setValue(deck.get('extendRev', 50))
|
||||
def accept():
|
||||
n = deck['extendNew'] = frm.newToday.value()
|
||||
r = deck['extendRev'] = frm.revToday.value()
|
||||
self.mw.col.decks.save(deck)
|
||||
self.mw.col.sched.extendLimits(n, r)
|
||||
self.mw.reset()
|
||||
d.connect(frm.buttonBox, SIGNAL("accepted()"), accept)
|
||||
d.exec_()
|
||||
|
||||
|
|
143
designer/limits.ui
Normal file
143
designer/limits.ui
Normal file
|
@ -0,0 +1,143 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>183</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Extend Limits</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="revToday"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="newToday"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Today's review limit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Today's new card limit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>To review cards before they are due, please use filter/cram.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>newToday</tabstop>
|
||||
<tabstop>revToday</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in a new issue