From 6dce4e0602a56a240d4e6520b25114fb984485d1 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 9 Feb 2010 01:52:06 +0900 Subject: [PATCH] add progress dialog to save as --- anki/deck.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/anki/deck.py b/anki/deck.py index 430f15bac..3c685401a 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -2271,6 +2271,7 @@ Return new path, relative to media dir.""" os.unlink(newPath) except OSError: pass + self.startProgress() # copy tables, avoiding implicit commit on current db DeckStorage.Deck(newPath).close() new = sqlite.connect(newPath) @@ -2285,8 +2286,12 @@ Return new path, relative to media dir.""" q += ",".join(["'||quote(\"" + col + "\")||'" for col in cols]) q += ")' from %(table)s" q = q % {'table': table} + c = 0 for row in self.s.execute(q): new.execute(row[0]) + if c % 1000: + self.updateProgress() + c += 1 # save new, close both new.commit() new.close() @@ -2300,6 +2305,7 @@ Return new path, relative to media dir.""" newDeck.syncName = None newDeck.s.commit() # and return the new deck + self.finishProgress() return newDeck # DB maintenance