From a9c945227122b065e263ea233927324443416842 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Oct 2013 14:28:45 +0900 Subject: [PATCH] bury card option --- anki/sched.py | 11 +++++++---- aqt/reviewer.py | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/anki/sched.py b/anki/sched.py index 1ac07d282..505ab47bb 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -1266,16 +1266,19 @@ To study outside of the normal schedule, click the Custom Study button below.""" "where queue = -1 and id in "+ ids2str(ids), intTime(), self.col.usn()) - def buryNote(self, nid): - "Bury all cards for note until next session." - cids = self.col.db.list( - "select id from cards where nid = ? and queue >= 0", nid) + def buryCards(self, cids): self.col.log(cids) self.removeLrn(cids) self.col.db.execute(""" update cards set queue=-2,mod=?,usn=? where id in """+ids2str(cids), intTime(), self.col.usn()) + def buryNote(self, nid): + "Bury all cards for note until next session." + cids = self.col.db.list( + "select id from cards where nid = ? and queue >= 0", nid) + self.buryCards(cids) + # Sibling spacing ########################################################################## diff --git a/aqt/reviewer.py b/aqt/reviewer.py index 430e3dbfe..19fa2f55a 100644 --- a/aqt/reviewer.py +++ b/aqt/reviewer.py @@ -3,9 +3,12 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from __future__ import division -import difflib, re, cgi +import difflib +import re +import cgi import unicodedata as ucd import HTMLParser + from anki.lang import _, ngettext from aqt.qt import * from anki.utils import stripHTML, isMac, json @@ -15,6 +18,7 @@ from aqt.utils import mungeQA, getBase, openLink, tooltip, askUserDialog from aqt.sound import getAudio import aqt + class Reviewer(object): "Manage reviews. Maintains a separate state." @@ -285,8 +289,10 @@ The front of this card is empty. Please run Tools>Empty Cards.""") self.replayAudio() elif key == "*": self.onMark() - elif key == "-": + elif key == "=": self.onBuryNote() + elif key == "-": + self.onBuryCard() elif key == "!": self.onSuspend() elif key == "@": @@ -678,7 +684,8 @@ function showAnswer(txt) { def showContextMenu(self): opts = [ [_("Mark Note"), "*", self.onMark], - [_("Bury Note"), "-", self.onBuryNote], + [_("Bury Card"), "-", self.onBuryCard], + [_("Bury Note"), "=", self.onBuryNote], [_("Suspend Card"), "@", self.onSuspendCard], [_("Suspend Note"), "!", self.onSuspend], [_("Delete Note"), "Delete", self.onDelete], @@ -740,6 +747,12 @@ function showAnswer(txt) { "Note and its %d cards deleted.", cnt) % cnt) + def onBuryCard(self): + self.mw.checkpoint(_("Bury")) + self.mw.col.sched.buryCards([self.card.id]) + self.mw.reset() + tooltip(_("Card buried.")) + def onBuryNote(self): self.mw.checkpoint(_("Bury")) self.mw.col.sched.buryNote(self.card.nid)