mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
max=0 to progress support
This commit is contained in:
parent
7026ef9bd8
commit
529ddef63a
1 changed files with 6 additions and 5 deletions
11
anki/deck.py
11
anki/deck.py
|
@ -1040,19 +1040,16 @@ where facts.id not in (select factId from cards)""")
|
||||||
self.s.flush()
|
self.s.flush()
|
||||||
now = time.time()
|
now = time.time()
|
||||||
strids = ids2str(ids)
|
strids = ids2str(ids)
|
||||||
self.startProgress(3)
|
self.startProgress()
|
||||||
# grab fact ids
|
# grab fact ids
|
||||||
factIds = self.s.column0("select factId from cards where id in %s"
|
factIds = self.s.column0("select factId from cards where id in %s"
|
||||||
% strids)
|
% strids)
|
||||||
# drop from cards
|
# drop from cards
|
||||||
self.updateProgress(_("Deleting cards..."))
|
|
||||||
self.s.statement("delete from cards where id in %s" % strids)
|
self.s.statement("delete from cards where id in %s" % strids)
|
||||||
# note deleted
|
# note deleted
|
||||||
self.updateProgress()
|
|
||||||
data = [{'id': id, 'time': now} for id in ids]
|
data = [{'id': id, 'time': now} for id in ids]
|
||||||
self.s.statements("insert into cardsDeleted values (:id, :time)", data)
|
self.s.statements("insert into cardsDeleted values (:id, :time)", data)
|
||||||
# remove any dangling facts
|
# remove any dangling facts
|
||||||
self.updateProgress()
|
|
||||||
self.deleteDanglingFacts()
|
self.deleteDanglingFacts()
|
||||||
self.rebuildCounts()
|
self.rebuildCounts()
|
||||||
self.flushMod()
|
self.flushMod()
|
||||||
|
@ -1535,6 +1532,7 @@ insert into cardTags
|
||||||
# these could be optimized to use the tag cache in the future
|
# these could be optimized to use the tag cache in the future
|
||||||
|
|
||||||
def addTags(self, ids, tags):
|
def addTags(self, ids, tags):
|
||||||
|
self.startProgress()
|
||||||
tlist = self.factTags(ids)
|
tlist = self.factTags(ids)
|
||||||
newTags = parseTags(tags)
|
newTags = parseTags(tags)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
@ -1558,8 +1556,10 @@ where id = :id""", pending)
|
||||||
self.updateCardTags(ids)
|
self.updateCardTags(ids)
|
||||||
self.updatePriorities(cardIds)
|
self.updatePriorities(cardIds)
|
||||||
self.flushMod()
|
self.flushMod()
|
||||||
|
self.finishProgress()
|
||||||
|
|
||||||
def deleteTags(self, ids, tags):
|
def deleteTags(self, ids, tags):
|
||||||
|
self.startProgress()
|
||||||
tlist = self.factTags(ids)
|
tlist = self.factTags(ids)
|
||||||
newTags = parseTags(tags)
|
newTags = parseTags(tags)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
@ -1588,6 +1588,7 @@ where id = :id""", pending)
|
||||||
self.updateCardTags(ids)
|
self.updateCardTags(ids)
|
||||||
self.updatePriorities(cardIds)
|
self.updatePriorities(cardIds)
|
||||||
self.flushMod()
|
self.flushMod()
|
||||||
|
self.finishProgress()
|
||||||
|
|
||||||
# Find and replace
|
# Find and replace
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -1634,7 +1635,7 @@ where id = :id""", pending)
|
||||||
# Progress info
|
# Progress info
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def startProgress(self, max=100, min=0, title=None):
|
def startProgress(self, max=0, min=0, title=None):
|
||||||
self.enableProgressHandler()
|
self.enableProgressHandler()
|
||||||
runHook("startProgress", max, min, title)
|
runHook("startProgress", max, min, title)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue