mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
Factor out addFact logic
This commit is contained in:
parent
79579676c5
commit
02c6e0c2bb
1 changed files with 13 additions and 6 deletions
|
|
@ -132,12 +132,7 @@ class AddCards(QDialog):
|
|||
"str": stripHTML(fact[fact.fields[0].name]),
|
||||
})
|
||||
|
||||
def addCards(self):
|
||||
# make sure updated
|
||||
self.editor.saveFieldsNow()
|
||||
fact = self.editor.fact
|
||||
n = _("Add")
|
||||
self.parent.deck.setUndoStart(n)
|
||||
def addFact(self, fact):
|
||||
try:
|
||||
fact = self.parent.deck.addFact(fact)
|
||||
except FactInvalidError:
|
||||
|
|
@ -152,6 +147,18 @@ question or answer on all cards."""), parent=self)
|
|||
return
|
||||
|
||||
self.reportAddedFact(fact)
|
||||
return fact
|
||||
|
||||
def addCards(self):
|
||||
# make sure updated
|
||||
self.editor.saveFieldsNow()
|
||||
fact = self.editor.fact
|
||||
n = _("Add")
|
||||
self.parent.deck.setUndoStart(n)
|
||||
|
||||
fact = self.addFact(fact)
|
||||
if not fact:
|
||||
return
|
||||
|
||||
# stop anything playing
|
||||
clearAudioQueue()
|
||||
|
|
|
|||
Loading…
Reference in a new issue