mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
make sure new cards have at least one step
This commit is contained in:
parent
9ac42a40a5
commit
f3d8434a4e
1 changed files with 7 additions and 2 deletions
|
@ -172,10 +172,12 @@ class DeckConf(QDialog):
|
||||||
# Saving
|
# Saving
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
def updateList(self, conf, key, w):
|
def updateList(self, conf, key, w, minSize=1):
|
||||||
items = unicode(w.text()).split(" ")
|
items = unicode(w.text()).split(" ")
|
||||||
ret = []
|
ret = []
|
||||||
for i in items:
|
for i in items:
|
||||||
|
if not i:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
i = float(i)
|
i = float(i)
|
||||||
assert i > 0
|
assert i > 0
|
||||||
|
@ -186,6 +188,9 @@ class DeckConf(QDialog):
|
||||||
# invalid, don't update
|
# invalid, don't update
|
||||||
showWarning(_("Steps must be numbers."))
|
showWarning(_("Steps must be numbers."))
|
||||||
return
|
return
|
||||||
|
if len(ret) < minSize:
|
||||||
|
showWarning(_("At least one step is required."))
|
||||||
|
return
|
||||||
conf[key] = ret
|
conf[key] = ret
|
||||||
|
|
||||||
def saveConf(self):
|
def saveConf(self):
|
||||||
|
@ -209,7 +214,7 @@ class DeckConf(QDialog):
|
||||||
c['fi'] = [f.fi1.value(), f.fi2.value()]
|
c['fi'] = [f.fi1.value(), f.fi2.value()]
|
||||||
# lapse
|
# lapse
|
||||||
c = self.conf['lapse']
|
c = self.conf['lapse']
|
||||||
self.updateList(c, 'delays', f.lapSteps)
|
self.updateList(c, 'delays', f.lapSteps, minSize=0)
|
||||||
c['mult'] = f.lapMult.value()/100.0
|
c['mult'] = f.lapMult.value()/100.0
|
||||||
c['minInt'] = f.lapMinInt.value()
|
c['minInt'] = f.lapMinInt.value()
|
||||||
c['leechFails'] = f.leechThreshold.value()
|
c['leechFails'] = f.leechThreshold.value()
|
||||||
|
|
Loading…
Reference in a new issue