mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
make sure undo is updated on col load
This commit is contained in:
parent
d7c4a55724
commit
7916dea182
1 changed files with 5 additions and 12 deletions
17
aqt/main.py
17
aqt/main.py
|
@ -250,6 +250,7 @@ Are you sure?"""):
|
||||||
if not guiOnly:
|
if not guiOnly:
|
||||||
self.col.reset()
|
self.col.reset()
|
||||||
runHook("reset")
|
runHook("reset")
|
||||||
|
self.maybeEnableUndo()
|
||||||
self.moveToState(self.state)
|
self.moveToState(self.state)
|
||||||
|
|
||||||
def requireReset(self, modal=False):
|
def requireReset(self, modal=False):
|
||||||
|
@ -460,7 +461,9 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
||||||
self.col.close()
|
self.col.close()
|
||||||
self.syncer = SyncManager(self, self.pm)
|
self.syncer = SyncManager(self, self.pm)
|
||||||
self.syncer.sync(auto)
|
self.syncer.sync(auto)
|
||||||
# then load collection and launch into the deck browser
|
self.loadCollection()
|
||||||
|
|
||||||
|
def loadCollection(self):
|
||||||
self.col = Collection(self.pm.collectionPath())
|
self.col = Collection(self.pm.collectionPath())
|
||||||
self.progress.setupDB(self.col.db)
|
self.progress.setupDB(self.col.db)
|
||||||
self.reset(guiOnly=True)
|
self.reset(guiOnly=True)
|
||||||
|
@ -609,6 +612,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
||||||
self.form.actionUndo.setEnabled(True)
|
self.form.actionUndo.setEnabled(True)
|
||||||
runHook("undoState", True)
|
runHook("undoState", True)
|
||||||
else:
|
else:
|
||||||
|
self.form.actionUndo.setText(_("Undo"))
|
||||||
self.form.actionUndo.setEnabled(False)
|
self.form.actionUndo.setEnabled(False)
|
||||||
runHook("undoState", False)
|
runHook("undoState", False)
|
||||||
|
|
||||||
|
@ -768,17 +772,6 @@ Please choose a new deck name:"""))
|
||||||
self.connect(m.actionDocumentation, s, self.onDocumentation)
|
self.connect(m.actionDocumentation, s, self.onDocumentation)
|
||||||
self.connect(m.actionDonate, s, self.onDonate)
|
self.connect(m.actionDonate, s, self.onDonate)
|
||||||
|
|
||||||
def enableDeckMenuItems(self, enabled=True):
|
|
||||||
"setEnabled deck-related items."
|
|
||||||
for item in self.deckRelatedMenuItems:
|
|
||||||
getattr(self.form, "action" + item).setEnabled(enabled)
|
|
||||||
self.maybeEnableUndo()
|
|
||||||
runHook("enableDeckMenuItems", enabled)
|
|
||||||
|
|
||||||
def disableDeckMenuItems(self):
|
|
||||||
"Disable deck-related items."
|
|
||||||
self.enableDeckMenuItems(enabled=False)
|
|
||||||
|
|
||||||
def updateTitleBar(self):
|
def updateTitleBar(self):
|
||||||
self.setWindowTitle("Anki")
|
self.setWindowTitle("Anki")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue