mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add quick db check
This commit is contained in:
parent
233406f174
commit
d205cd7602
2 changed files with 28 additions and 6 deletions
|
@ -1926,7 +1926,8 @@ Couldn't contact Anki Online. Please check your internet connection.""")
|
||||||
self.connect(m.actionRepeatAudio, s, self.onRepeatAudio)
|
self.connect(m.actionRepeatAudio, s, self.onRepeatAudio)
|
||||||
self.connect(m.actionUndo, s, self.onUndo)
|
self.connect(m.actionUndo, s, self.onUndo)
|
||||||
self.connect(m.actionRedo, s, self.onRedo)
|
self.connect(m.actionRedo, s, self.onRedo)
|
||||||
self.connect(m.actionCheckDatabaseIntegrity, s, self.onCheckDB)
|
self.connect(m.actionCheckDatabaseIntegrity, s, self.onQuickCheckDB)
|
||||||
|
self.connect(m.actionFullDatabaseCheck, s, self.onCheckDB)
|
||||||
self.connect(m.actionOptimizeDatabase, s, self.onOptimizeDB)
|
self.connect(m.actionOptimizeDatabase, s, self.onOptimizeDB)
|
||||||
self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB)
|
self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB)
|
||||||
self.connect(m.actionCram, s, self.onCram)
|
self.connect(m.actionCram, s, self.onCram)
|
||||||
|
@ -2316,13 +2317,16 @@ Couldn't contact Anki Online. Please check your internet connection.""")
|
||||||
# Advanced features
|
# Advanced features
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def onCheckDB(self):
|
def onQuickCheckDB(self):
|
||||||
|
self.onCheckDB(full=False)
|
||||||
|
|
||||||
|
def onCheckDB(self, full=True):
|
||||||
"True if no problems"
|
"True if no problems"
|
||||||
if self.errorOccurred:
|
if self.errorOccurred:
|
||||||
ui.utils.showWarning(_(
|
ui.utils.showWarning(_(
|
||||||
"Please restart Anki before checking the DB."))
|
"Please restart Anki before checking the DB."))
|
||||||
return
|
return
|
||||||
if not ui.utils.askUser(_("""\
|
if full and not ui.utils.askUser(_("""\
|
||||||
This operation will find and fix some common problems.<br>
|
This operation will find and fix some common problems.<br>
|
||||||
<br>
|
<br>
|
||||||
On the next sync, all cards will be sent to the server.<br>
|
On the next sync, all cards will be sent to the server.<br>
|
||||||
|
@ -2331,12 +2335,23 @@ Any changes on the server since your last sync will be lost.<br>
|
||||||
<b>This operation is not undoable.</b><br>
|
<b>This operation is not undoable.</b><br>
|
||||||
Proceed?""")):
|
Proceed?""")):
|
||||||
return
|
return
|
||||||
ret = self.deck.fixIntegrity()
|
ret = self.deck.fixIntegrity(quick=not full)
|
||||||
if ret == "ok":
|
if ret == "ok":
|
||||||
ret = True
|
ret = True
|
||||||
else:
|
else:
|
||||||
ret = _("Problems found:\n%s") % ret
|
ret = _("Problems found:\n%s") % ret
|
||||||
ui.utils.showWarning(ret)
|
diag = QDialog(self)
|
||||||
|
diag.setWindowTitle("Anki")
|
||||||
|
layout = QVBoxLayout(diag)
|
||||||
|
diag.setLayout(layout)
|
||||||
|
text = QTextEdit()
|
||||||
|
text.setReadOnly(True)
|
||||||
|
text.setPlainText(ret)
|
||||||
|
layout.addWidget(text)
|
||||||
|
box = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
|
layout.addWidget(box)
|
||||||
|
self.connect(box, SIGNAL("rejected()"), diag, SLOT("reject()"))
|
||||||
|
diag.exec_()
|
||||||
ret = False
|
ret = False
|
||||||
self.reset()
|
self.reset()
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -1209,6 +1209,7 @@
|
||||||
<string>Ad&vanced</string>
|
<string>Ad&vanced</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionCheckDatabaseIntegrity" />
|
<addaction name="actionCheckDatabaseIntegrity" />
|
||||||
|
<addaction name="actionFullDatabaseCheck" />
|
||||||
<addaction name="actionOptimizeDatabase" />
|
<addaction name="actionOptimizeDatabase" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
<addaction name="actionCheckMediaDatabase" />
|
<addaction name="actionCheckMediaDatabase" />
|
||||||
|
@ -1216,6 +1217,7 @@
|
||||||
<addaction name="actionUncacheLatex" />
|
<addaction name="actionUncacheLatex" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
<addaction name="actionRecordNoiseProfile" />
|
<addaction name="actionRecordNoiseProfile" />
|
||||||
|
<addaction name="separator" />
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="actionGraphs" />
|
<addaction name="actionGraphs" />
|
||||||
<addaction name="actionDstats" />
|
<addaction name="actionDstats" />
|
||||||
|
@ -1731,7 +1733,7 @@
|
||||||
<normaloff>:/icons/sqlitebrowser.png</normaloff>:/icons/sqlitebrowser.png</iconset>
|
<normaloff>:/icons/sqlitebrowser.png</normaloff>:/icons/sqlitebrowser.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Check Database...</string>
|
<string>Quick Database Check</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip" >
|
<property name="statusTip" >
|
||||||
<string>Check the database for errors</string>
|
<string>Check the database for errors</string>
|
||||||
|
@ -1964,6 +1966,11 @@
|
||||||
<string>Ctrl+Shift+B</string>
|
<string>Ctrl+Shift+B</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFullDatabaseCheck" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Full Database Check...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>newPerDay</tabstop>
|
<tabstop>newPerDay</tabstop>
|
||||||
|
|
Loading…
Reference in a new issue