bury card option

This commit is contained in:
Damien Elmes 2013-10-22 14:28:45 +09:00
parent 004998c8ec
commit a9c9452271
2 changed files with 23 additions and 7 deletions

View File

@ -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
##########################################################################

View File

@ -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)