mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Factor out reportAddedFact
This commit is contained in:
parent
bd595a1e0d
commit
79579676c5
1 changed files with 13 additions and 8 deletions
|
@ -122,6 +122,16 @@ class AddCards(QDialog):
|
||||||
self.setTabOrder(self.addButton, self.closeButton)
|
self.setTabOrder(self.addButton, self.closeButton)
|
||||||
self.setTabOrder(self.closeButton, self.helpButton)
|
self.setTabOrder(self.closeButton, self.helpButton)
|
||||||
|
|
||||||
|
def reportAddedFact(self, fact):
|
||||||
|
self.dialog.status.append(
|
||||||
|
_("Added %(num)d card(s) for <a href=\"%(id)d\">"
|
||||||
|
"%(str)s</a>.") % {
|
||||||
|
"num": len(fact.cards),
|
||||||
|
"id": fact.id,
|
||||||
|
# we're guaranteed that all fields will exist now
|
||||||
|
"str": stripHTML(fact[fact.fields[0].name]),
|
||||||
|
})
|
||||||
|
|
||||||
def addCards(self):
|
def addCards(self):
|
||||||
# make sure updated
|
# make sure updated
|
||||||
self.editor.saveFieldsNow()
|
self.editor.saveFieldsNow()
|
||||||
|
@ -140,14 +150,9 @@ class AddCards(QDialog):
|
||||||
The input you have provided would make an empty
|
The input you have provided would make an empty
|
||||||
question or answer on all cards."""), parent=self)
|
question or answer on all cards."""), parent=self)
|
||||||
return
|
return
|
||||||
self.dialog.status.append(
|
|
||||||
_("Added %(num)d card(s) for <a href=\"%(id)d\">"
|
self.reportAddedFact(fact)
|
||||||
"%(str)s</a>.") % {
|
|
||||||
"num": len(fact.cards),
|
|
||||||
"id": fact.id,
|
|
||||||
# we're guaranteed that all fields will exist now
|
|
||||||
"str": stripHTML(fact[fact.fields[0].name]),
|
|
||||||
})
|
|
||||||
# stop anything playing
|
# stop anything playing
|
||||||
clearAudioQueue()
|
clearAudioQueue()
|
||||||
self.parent.deck.setUndoEnd(n)
|
self.parent.deck.setUndoEnd(n)
|
||||||
|
|
Loading…
Reference in a new issue