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.actionUndo, s, self.onUndo)
|
||||
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.actionCheckMediaDatabase, s, self.onCheckMediaDB)
|
||||
self.connect(m.actionCram, s, self.onCram)
|
||||
|
@ -2316,13 +2317,16 @@ Couldn't contact Anki Online. Please check your internet connection.""")
|
|||
# Advanced features
|
||||
##########################################################################
|
||||
|
||||
def onCheckDB(self):
|
||||
def onQuickCheckDB(self):
|
||||
self.onCheckDB(full=False)
|
||||
|
||||
def onCheckDB(self, full=True):
|
||||
"True if no problems"
|
||||
if self.errorOccurred:
|
||||
ui.utils.showWarning(_(
|
||||
"Please restart Anki before checking the DB."))
|
||||
return
|
||||
if not ui.utils.askUser(_("""\
|
||||
if full and not ui.utils.askUser(_("""\
|
||||
This operation will find and fix some common problems.<br>
|
||||
<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>
|
||||
Proceed?""")):
|
||||
return
|
||||
ret = self.deck.fixIntegrity()
|
||||
ret = self.deck.fixIntegrity(quick=not full)
|
||||
if ret == "ok":
|
||||
ret = True
|
||||
else:
|
||||
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
|
||||
self.reset()
|
||||
return ret
|
||||
|
|
|
@ -1209,6 +1209,7 @@
|
|||
<string>Ad&vanced</string>
|
||||
</property>
|
||||
<addaction name="actionCheckDatabaseIntegrity" />
|
||||
<addaction name="actionFullDatabaseCheck" />
|
||||
<addaction name="actionOptimizeDatabase" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionCheckMediaDatabase" />
|
||||
|
@ -1216,6 +1217,7 @@
|
|||
<addaction name="actionUncacheLatex" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionRecordNoiseProfile" />
|
||||
<addaction name="separator" />
|
||||
</widget>
|
||||
<addaction name="actionGraphs" />
|
||||
<addaction name="actionDstats" />
|
||||
|
@ -1731,7 +1733,7 @@
|
|||
<normaloff>:/icons/sqlitebrowser.png</normaloff>:/icons/sqlitebrowser.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Check Database...</string>
|
||||
<string>Quick Database Check</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Check the database for errors</string>
|
||||
|
@ -1964,6 +1966,11 @@
|
|||
<string>Ctrl+Shift+B</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFullDatabaseCheck" >
|
||||
<property name="text" >
|
||||
<string>Full Database Check...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>newPerDay</tabstop>
|
||||
|
|
Loading…
Reference in a new issue