From d205cd760280996153f4f86504ca1aca28760b91 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 16 May 2009 02:47:27 +0900 Subject: [PATCH] add quick db check --- ankiqt/ui/main.py | 25 ++++++++++++++++++++----- designer/main.ui | 9 ++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 986d5395a..21b68fe23 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -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.

On the next sync, all cards will be sent to the server.
@@ -2331,12 +2335,23 @@ Any changes on the server since your last sync will be lost.
This operation is not undoable.
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 diff --git a/designer/main.ui b/designer/main.ui index e47d339c9..36598614c 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -1209,6 +1209,7 @@ Ad&vanced + @@ -1216,6 +1217,7 @@ + @@ -1731,7 +1733,7 @@ :/icons/sqlitebrowser.png:/icons/sqlitebrowser.png - Check Database... + Quick Database Check Check the database for errors @@ -1964,6 +1966,11 @@ Ctrl+Shift+B + + + Full Database Check... + + newPerDay