mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
catch more problems with corrupt collections
if collapseTime is missing from col.conf, the initial load was succeeding, but then the UI was getting stuck in moveToState()
This commit is contained in:
parent
e7046ba398
commit
275af7e9b5
1 changed files with 15 additions and 2 deletions
17
aqt/main.py
17
aqt/main.py
|
@ -319,9 +319,8 @@ close the profile or restart Anki."""))
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def loadCollection(self):
|
def loadCollection(self):
|
||||||
cpath = self.pm.collectionPath()
|
|
||||||
try:
|
try:
|
||||||
self.col = Collection(cpath, log=True)
|
return self._loadCollection()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
showWarning(_("""\
|
showWarning(_("""\
|
||||||
Anki was unable to open your collection file. If problems persist after \
|
Anki was unable to open your collection file. If problems persist after \
|
||||||
|
@ -330,9 +329,23 @@ manager.
|
||||||
|
|
||||||
Debug info:
|
Debug info:
|
||||||
""")+traceback.format_exc())
|
""")+traceback.format_exc())
|
||||||
|
# clean up open collection if possible
|
||||||
|
if self.col:
|
||||||
|
try:
|
||||||
|
self.col.close(save=False)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.col = None
|
||||||
|
|
||||||
|
# return to profile manager
|
||||||
self.showProfileManager()
|
self.showProfileManager()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _loadCollection(self):
|
||||||
|
cpath = self.pm.collectionPath()
|
||||||
|
|
||||||
|
self.col = Collection(cpath, log=True)
|
||||||
|
|
||||||
self.setEnabled(True)
|
self.setEnabled(True)
|
||||||
self.progress.setupDB(self.col.db)
|
self.progress.setupDB(self.col.db)
|
||||||
self.maybeEnableUndo()
|
self.maybeEnableUndo()
|
||||||
|
|
Loading…
Reference in a new issue