diff --git a/aqt/main.py b/aqt/main.py
index 28816c128..c642a404a 100755
--- a/aqt/main.py
+++ b/aqt/main.py
@@ -529,7 +529,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
self.reviewer.card.note().hasTag("marked"))
self.form.actionMarkCard.blockSignals(False)
- def onMark(self, toggled):
+ def onMark(self):
f = self.reviewer.card.note()
if f.hasTag("marked"):
f.delTag("marked")
@@ -539,12 +539,13 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
def onSuspend(self):
self.checkpoint(_("Suspend"))
- self.col.sched.suspendCards([self.reviewer.card.id])
+ self.col.sched.suspendCards(
+ [c.id for c in self.reviewer.card.note().cards()])
self.reviewer.nextCard()
def onDelete(self):
self.checkpoint(_("Delete"))
- self.col.remCards([self.reviewer.card.id])
+ self.col.remNotes([self.reviewer.card.note().id])
self.reviewer.nextCard()
def onBuryNote(self):
@@ -771,12 +772,6 @@ Please choose a new deck name:"""))
_(" Please ensure it is set correctly and then restart Anki.")
)
- # Sounds
- ##########################################################################
-
- def onRepeatAudio(self):
- self.reviewer.replayAudio()
-
# Schema modifications
##########################################################################
diff --git a/aqt/overview.py b/aqt/overview.py
index c59606091..380874cea 100644
--- a/aqt/overview.py
+++ b/aqt/overview.py
@@ -66,11 +66,6 @@ class Overview(object):
shareLink = 'Reviews and Updates'
else:
shareLink = ""
- print self._body % dict(
- deck=deck['name'],
- shareLink=shareLink,
- desc=self._desc(deck),
- table=self._table())
self.web.stdHtml(self._body % dict(
deck=deck['name'],
shareLink=shareLink,
@@ -110,7 +105,7 @@ class Overview(object):
%s | ''' % (_("New"), counts[0],
_("In Learning"), counts[1],
_("To Review"), counts[2],
- but("study", _("Study")))
+ but("study", _("Study"), id="study"))
_body = """
@@ -120,6 +115,7 @@ class Overview(object):
%(table)s
+
"""
_css = """
diff --git a/aqt/reviewer.py b/aqt/reviewer.py
index a22e70fdd..4dd4086be 100644
--- a/aqt/reviewer.py
+++ b/aqt/reviewer.py
@@ -8,7 +8,7 @@ from aqt.qt import *
from anki.utils import fmtTimeSpan, stripHTML
from anki.hooks import addHook, runHook, runFilter
from anki.sound import playFromText, clearAudioQueue, hasSound
-from aqt.utils import mungeQA, getBase
+from aqt.utils import mungeQA, getBase, shortcut
import aqt
class Reviewer(object):
@@ -68,9 +68,9 @@ class Reviewer(object):
def replayAudio(self):
clearAudioQueue()
c = self.card
- if not c.template()['hideQ'] or self.state == "question":
+ if self.state == "question":
playFromText(c.q())
- if self.state == "answer":
+ elif self.state == "answer":
playFromText(c.a())
# Initializing the webview
@@ -186,6 +186,7 @@ function _typeAnsPress() {
############################################################
def _keyHandler(self, evt):
+ print "rev event", evt.key()
if self.state == "question":
show = False
if evt.key() == Qt.Key_Space and self.typeAns() is None:
@@ -363,7 +364,7 @@ button { font-weight: normal; }
return """
-1 + 7 + 3
+ | %(rem)s
|
%(middle)s
@@ -374,7 +375,7 @@ button { font-weight: normal; }
|
-""" % dict(middle=middle, edit=_("Edit"), more=_("More"))
+""" % dict(middle=middle, rem=self._remaining(), edit=_("Edit"), more=_("More"))
def _showAnswerButton(self):
self.bottom.web.setFocus()
@@ -393,6 +394,16 @@ button { font-weight: normal; }
self._bottomHTML(self._answerButtons()),
self.bottom._css + self._bottomCSS)
+ def _remaining(self):
+ counts = list(self.mw.col.sched.repCounts())
+ idx = self.mw.col.sched.countIdx(self.card)
+ counts[idx] = "%s" % (counts[idx]+1)
+ space = " + "
+ ctxt = '%s' % counts[0]
+ ctxt += space + '%s' % counts[1]
+ ctxt += space + '%s' % counts[2]
+ return ctxt
+
def _defaultEase(self):
if self.mw.col.sched.answerButtons(self.card) == 4:
return 3
@@ -430,19 +441,6 @@ button { font-weight: normal; }
txt = self.mw.col.sched.nextIvlStr(self.card, i+1, True)
return '%s
' % txt
- # Status bar
- ##########################################################################
-
- def _remaining(self):
- counts = list(self.mw.col.sched.repCounts())
- idx = self.mw.col.sched.countIdx(self.card)
- counts[idx] = "%s" % (counts[idx]+1)
- space = " " * 2
- ctxt = '%s' % counts[0]
- ctxt += space + '%s' % counts[1]
- ctxt += space + '%s' % counts[2]
- return ctxt
-
# Leeches
##########################################################################
@@ -457,3 +455,21 @@ Card was a leech.""") % link)
"select 1 from cards where id = :id and type < 0", id=cardId):
txt += _(" It has been suspended.")
self.setNotice(txt)
+
+
+ # Context menu
+ ##########################################################################
+
+ def showContextMenu(self):
+ opts = [
+ [_("Replay Audio (r)"), self.replayAudio],
+ [_("Mark Note (m)"), self.mw.onMark],
+ [_("Bury Note (b)"), self.mw.onBuryNote],
+ [_("Suspend Note (!)"), self.mw.onSuspend],
+ [shortcut(_("Delete Note (Ctrl+delete)")), self.mw.onDelete]
+ ]
+ m = QMenu(self.mw)
+ for label, func in opts:
+ a = m.addAction(label)
+ a.connect(a, SIGNAL("triggered()"), func)
+ m.exec_(QCursor.pos())
diff --git a/aqt/toolbar.py b/aqt/toolbar.py
index f9b4477f8..bcca3ca72 100644
--- a/aqt/toolbar.py
+++ b/aqt/toolbar.py
@@ -57,9 +57,10 @@ class Toolbar(object):
######################################################################
def _linkHandler(self, l):
- if l == "anki":
- self.showMenu()
- elif l == "decks":
+ # first set focus back to main window, or we're left with an ugly
+ # focus ring around the clicked item
+ self.mw.web.setFocus()
+ if l == "decks":
self.mw.moveToState("deckBrowser")
elif l == "study":
# if overview already shown, switch to review
@@ -92,12 +93,13 @@ class Toolbar(object):
#header {
font-size: 12px;
margin:0;
-background: -webkit-gradient(linear, left top, left bottom,
-from(#ddd), to(#fff));
+margin-top: 4px;
font-weight: bold;
}
body {
+background: -webkit-gradient(linear, left top, left bottom,
+ from(#ddd), to(#fff));
margin: 0; padding: 0;
-webkit-user-select: none;
border-bottom: 1px solid #aaa;
@@ -105,12 +107,13 @@ border-bottom: 1px solid #aaa;
* { -webkit-user-drag: none; }
-.hitem { display: inline-block; padding: 4px; padding-right: 6px;
-text-decoration: none; color: #000;
+.hitem {
+padding-right: 6px;
+text-decoration: none;
+color: #000;
}
.hitem:hover {
-background: #333;
-color: #fff;
+text-decoration: underline;
}
"""
@@ -123,6 +126,7 @@ from(#fff), to(#ddd));
border-bottom: 0;
border-top: 1px solid #aaa;
margin-bottom: 6px;
+margin-top: 0;
}
td { font-size: 12px; }
"""