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)
|
os.unlink(newPath)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
self.startProgress()
|
||||||
# copy tables, avoiding implicit commit on current db
|
# copy tables, avoiding implicit commit on current db
|
||||||
DeckStorage.Deck(newPath).close()
|
DeckStorage.Deck(newPath).close()
|
||||||
new = sqlite.connect(newPath)
|
new = sqlite.connect(newPath)
|
||||||
|
@ -2285,8 +2286,12 @@ Return new path, relative to media dir."""
|
||||||
q += ",".join(["'||quote(\"" + col + "\")||'" for col in cols])
|
q += ",".join(["'||quote(\"" + col + "\")||'" for col in cols])
|
||||||
q += ")' from %(table)s"
|
q += ")' from %(table)s"
|
||||||
q = q % {'table': table}
|
q = q % {'table': table}
|
||||||
|
c = 0
|
||||||
for row in self.s.execute(q):
|
for row in self.s.execute(q):
|
||||||
new.execute(row[0])
|
new.execute(row[0])
|
||||||
|
if c % 1000:
|
||||||
|
self.updateProgress()
|
||||||
|
c += 1
|
||||||
# save new, close both
|
# save new, close both
|
||||||
new.commit()
|
new.commit()
|
||||||
new.close()
|
new.close()
|
||||||
|
@ -2300,6 +2305,7 @@ Return new path, relative to media dir."""
|
||||||
newDeck.syncName = None
|
newDeck.syncName = None
|
||||||
newDeck.s.commit()
|
newDeck.s.commit()
|
||||||
# and return the new deck
|
# and return the new deck
|
||||||
|
self.finishProgress()
|
||||||
return newDeck
|
return newDeck
|
||||||
|
|
||||||
# DB maintenance
|
# DB maintenance
|
||||||
|
|
Loading…
Reference in a new issue