From 79579676c506721b7ef71629b895e1b3a4954f11 Mon Sep 17 00:00:00 2001 From: Shawn M Moore Date: Sun, 14 Feb 2010 17:49:20 -0500 Subject: [PATCH] Factor out reportAddedFact --- ankiqt/ui/addcards.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ankiqt/ui/addcards.py b/ankiqt/ui/addcards.py index 3b6af5d3a..edcd9adc9 100644 --- a/ankiqt/ui/addcards.py +++ b/ankiqt/ui/addcards.py @@ -122,6 +122,16 @@ class AddCards(QDialog): self.setTabOrder(self.addButton, self.closeButton) self.setTabOrder(self.closeButton, self.helpButton) + def reportAddedFact(self, fact): + self.dialog.status.append( + _("Added %(num)d card(s) for " + "%(str)s.") % { + "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): # make sure updated self.editor.saveFieldsNow() @@ -140,14 +150,9 @@ class AddCards(QDialog): The input you have provided would make an empty question or answer on all cards."""), parent=self) return - self.dialog.status.append( - _("Added %(num)d card(s) for " - "%(str)s.") % { - "num": len(fact.cards), - "id": fact.id, - # we're guaranteed that all fields will exist now - "str": stripHTML(fact[fact.fields[0].name]), - }) + + self.reportAddedFact(fact) + # stop anything playing clearAudioQueue() self.parent.deck.setUndoEnd(n)