mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
remember saveas location, if untitled deck empty delete it
This commit is contained in:
parent
03a6235f35
commit
cc903e2d02
1 changed files with 6 additions and 0 deletions
|
@ -604,6 +604,9 @@ Error was:\n%(f1)s\n...\n%(f2)s""") % {'f1': fmt1, 'f2': fmt2})
|
||||||
"(Auto)save and close. Prompt if necessary. True if okay to proceed."
|
"(Auto)save and close. Prompt if necessary. True if okay to proceed."
|
||||||
self.hideWelcome = hideWelcome
|
self.hideWelcome = hideWelcome
|
||||||
if self.deck is not None:
|
if self.deck is not None:
|
||||||
|
count = self.deck.cardCount
|
||||||
|
path = self.deck.path
|
||||||
|
name = self.deck.name()
|
||||||
# sync (saving automatically)
|
# sync (saving automatically)
|
||||||
if self.config['syncOnClose'] and self.deck.syncName:
|
if self.config['syncOnClose'] and self.deck.syncName:
|
||||||
self.syncDeck(False, reload=False)
|
self.syncDeck(False, reload=False)
|
||||||
|
@ -626,6 +629,8 @@ Error was:\n%(f1)s\n...\n%(f2)s""") % {'f1': fmt1, 'f2': fmt2})
|
||||||
# close
|
# close
|
||||||
self.deck.rollback()
|
self.deck.rollback()
|
||||||
self.deck = None
|
self.deck = None
|
||||||
|
if name.startswith("untitled") and not count:
|
||||||
|
os.unlink(path)
|
||||||
if not hideWelcome:
|
if not hideWelcome:
|
||||||
self.moveToState("noDeck")
|
self.moveToState("noDeck")
|
||||||
return True
|
return True
|
||||||
|
@ -740,6 +745,7 @@ Error was:\n%(f1)s\n...\n%(f2)s""") % {'f1': fmt1, 'f2': fmt2})
|
||||||
self.deck = self.deck.saveAs(file)
|
self.deck = self.deck.saveAs(file)
|
||||||
self.deck.initUndo()
|
self.deck.initUndo()
|
||||||
self.updateTitleBar()
|
self.updateTitleBar()
|
||||||
|
self.updateRecentFiles(self.deck.path)
|
||||||
self.moveToState("initial")
|
self.moveToState("initial")
|
||||||
|
|
||||||
def saveDeck(self):
|
def saveDeck(self):
|
||||||
|
|
Loading…
Reference in a new issue