mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
generate cards in fact order
This commit is contained in:
parent
c6d9d0ceec
commit
d2528e8605
1 changed files with 14 additions and 4 deletions
|
@ -354,7 +354,7 @@ class EditDeck(QMainWindow):
|
||||||
self.dialog.tagList.setFixedWidth(130)
|
self.dialog.tagList.setFixedWidth(130)
|
||||||
self.dialog.tagList.clear()
|
self.dialog.tagList.clear()
|
||||||
self.dialog.tagList.addItems(QStringList(
|
self.dialog.tagList.addItems(QStringList(
|
||||||
[_('All cards'), _('No tags')] + self.alltags))
|
[_('<Tag filter>'), _('No tags')] + self.alltags))
|
||||||
self.dialog.tagList.view().setFixedWidth(300)
|
self.dialog.tagList.view().setFixedWidth(300)
|
||||||
|
|
||||||
def drawSort(self):
|
def drawSort(self):
|
||||||
|
@ -723,18 +723,28 @@ where id in %s""" % ids2str(sf))
|
||||||
_("Can only operate on one model at a time."),
|
_("Can only operate on one model at a time."),
|
||||||
parent=self)
|
parent=self)
|
||||||
return
|
return
|
||||||
|
# get cards to enable
|
||||||
cms = [x.id for x in self.deck.s.query(Fact).get(sf[0]).\
|
cms = [x.id for x in self.deck.s.query(Fact).get(sf[0]).\
|
||||||
model.cardModels]
|
model.cardModels]
|
||||||
d = AddCardChooser(self, cms)
|
d = AddCardChooser(self, cms)
|
||||||
if not d.exec_():
|
if not d.exec_():
|
||||||
return
|
return
|
||||||
|
# for each fact id, generate
|
||||||
n = _("Generate Cards")
|
n = _("Generate Cards")
|
||||||
|
self.parent.setProgressParent(self)
|
||||||
|
self.deck.startProgress()
|
||||||
self.deck.setUndoStart(n)
|
self.deck.setUndoStart(n)
|
||||||
for id in sf:
|
facts = self.deck.s.query(Fact).filter(
|
||||||
self.deck.addCards(self.deck.s.query(Fact).get(id),
|
text("id in %s" % ids2str(sf))).order_by(Fact.created).all()
|
||||||
d.selectedCms)
|
self.deck.updateProgress(_("Generating Cards..."))
|
||||||
|
for c, fact in enumerate(facts):
|
||||||
|
self.deck.addCards(fact, d.selectedCms)
|
||||||
|
if c % 50 == 0:
|
||||||
|
self.deck.updateProgress()
|
||||||
self.deck.flushMod()
|
self.deck.flushMod()
|
||||||
self.deck.updateAllPriorities()
|
self.deck.updateAllPriorities()
|
||||||
|
self.deck.finishProgress()
|
||||||
|
self.parent.setProgressParent(None)
|
||||||
self.deck.setUndoEnd(n)
|
self.deck.setUndoEnd(n)
|
||||||
self.updateSearch()
|
self.updateSearch()
|
||||||
self.updateAfterCardChange()
|
self.updateAfterCardChange()
|
||||||
|
|
Loading…
Reference in a new issue