mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
catch deck errors better, add get more decks options
This commit is contained in:
parent
b0835c11c8
commit
913cc9712d
2 changed files with 32 additions and 7 deletions
|
@ -432,12 +432,23 @@ class AnkiQt(QMainWindow):
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
self.rebuildQueue()
|
self.rebuildQueue()
|
||||||
except OperationalError:
|
except:
|
||||||
ui.utils.showWarning(_(
|
traceback.print_exc()
|
||||||
"Error building queue. Attempting recovery.."))
|
if ui.utils.askUser(_(
|
||||||
|
"An error occurred while trying to build the queue.\n"
|
||||||
|
"Would you like to try check the deck for errors?\n"
|
||||||
|
"This may take some time.")):
|
||||||
self.onCheckDB()
|
self.onCheckDB()
|
||||||
# try again
|
# try again
|
||||||
|
try:
|
||||||
self.rebuildQueue()
|
self.rebuildQueue()
|
||||||
|
except:
|
||||||
|
ui.utils.showWarning(
|
||||||
|
_("Unable to recover. Deck load failed."))
|
||||||
|
self.deck = None
|
||||||
|
else:
|
||||||
|
self.deck = None
|
||||||
|
return 0
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def importOldDeck(self, deckPath):
|
def importOldDeck(self, deckPath):
|
||||||
|
@ -755,7 +766,7 @@ class AnkiQt(QMainWindow):
|
||||||
elif str == "openrem":
|
elif str == "openrem":
|
||||||
self.onOpenOnline()
|
self.onOpenOnline()
|
||||||
elif str == "more":
|
elif str == "more":
|
||||||
QDesktopServices.openUrl(QUrl(ankiqt.appMoreDecks))
|
self.onGetMoreDecks()
|
||||||
if str == "addfacts":
|
if str == "addfacts":
|
||||||
if not self.deck:
|
if not self.deck:
|
||||||
self.onNew()
|
self.onNew()
|
||||||
|
@ -973,6 +984,9 @@ class AnkiQt(QMainWindow):
|
||||||
def onActiveTags(self):
|
def onActiveTags(self):
|
||||||
ui.activetags.show(self)
|
ui.activetags.show(self)
|
||||||
|
|
||||||
|
def onGetMoreDecks(self):
|
||||||
|
QDesktopServices.openUrl(QUrl(ankiqt.appMoreDecks))
|
||||||
|
|
||||||
# Importing & exporting
|
# Importing & exporting
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
@ -1250,6 +1264,7 @@ class AnkiQt(QMainWindow):
|
||||||
self.connect(m.actionDisableAllPlugins, s, self.onDisableAllPlugins)
|
self.connect(m.actionDisableAllPlugins, s, self.onDisableAllPlugins)
|
||||||
self.connect(m.actionActiveTags, s, self.onActiveTags)
|
self.connect(m.actionActiveTags, s, self.onActiveTags)
|
||||||
self.connect(m.actionReleaseNotes, s, self.onReleaseNotes)
|
self.connect(m.actionReleaseNotes, s, self.onReleaseNotes)
|
||||||
|
self.connect(m.actionGetMoreDecks, s, self.onGetMoreDecks)
|
||||||
|
|
||||||
def enableDeckMenuItems(self, enabled=True):
|
def enableDeckMenuItems(self, enabled=True):
|
||||||
"setEnabled deck-related items."
|
"setEnabled deck-related items."
|
||||||
|
|
|
@ -370,6 +370,7 @@
|
||||||
<addaction name="actionReportbug" />
|
<addaction name="actionReportbug" />
|
||||||
<addaction name="actionForum" />
|
<addaction name="actionForum" />
|
||||||
<addaction name="actionReleaseNotes" />
|
<addaction name="actionReleaseNotes" />
|
||||||
|
<addaction name="actionGetMoreDecks" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
<addaction name="actionAbout" />
|
<addaction name="actionAbout" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
|
@ -1000,6 +1001,15 @@
|
||||||
<string>Active &Tags..</string>
|
<string>Active &Tags..</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionGetMoreDecks" >
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../icons.qrc" >
|
||||||
|
<normaloff>:/icons/khtml_kget.png</normaloff>:/icons/khtml_kget.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Get More Decks..</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc" />
|
<include location="../icons.qrc" />
|
||||||
|
|
Loading…
Reference in a new issue