mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
reduce the chances of add-ons preventing collections from loading
https://anki.tenderapp.com/discussions/ankidesktop/39953-sync-fail-with-images#comment_48182205
This commit is contained in:
parent
8c80f96314
commit
65b8988817
1 changed files with 14 additions and 7 deletions
|
@ -442,7 +442,7 @@ close the profile or restart Anki."""
|
|||
|
||||
def loadCollection(self) -> bool:
|
||||
try:
|
||||
return self._loadCollection()
|
||||
self._loadCollection()
|
||||
except Exception as e:
|
||||
showWarning(
|
||||
tr(TR.ERRORS_UNABLE_OPEN_COLLECTION) + "\n" + traceback.format_exc()
|
||||
|
@ -460,15 +460,22 @@ close the profile or restart Anki."""
|
|||
self.showProfileManager()
|
||||
return False
|
||||
|
||||
def _loadCollection(self) -> bool:
|
||||
# make sure we don't get into an inconsistent state if an add-on
|
||||
# has broken the deck browser or the did_load hook
|
||||
try:
|
||||
self.maybeEnableUndo()
|
||||
gui_hooks.collection_did_load(self.col)
|
||||
self.moveToState("deckBrowser")
|
||||
except Exception as e:
|
||||
# dump error to stderr so it gets picked up by errors.py
|
||||
traceback.print_exc()
|
||||
|
||||
return True
|
||||
|
||||
def _loadCollection(self):
|
||||
cpath = self.pm.collectionPath()
|
||||
self.col = Collection(cpath, backend=self.backend)
|
||||
|
||||
self.setEnabled(True)
|
||||
self.maybeEnableUndo()
|
||||
gui_hooks.collection_did_load(self.col)
|
||||
self.moveToState("deckBrowser")
|
||||
return True
|
||||
|
||||
def reopen(self):
|
||||
cpath = self.pm.collectionPath()
|
||||
|
|
Loading…
Reference in a new issue