mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add progress dialog to save as
This commit is contained in:
parent
ae690ccea3
commit
6dce4e0602
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue