diff --git a/aqt/main.py b/aqt/main.py
index ee59d5ce1..9211522ba 100755
--- a/aqt/main.py
+++ b/aqt/main.py
@@ -102,8 +102,10 @@ class AnkiQt(QMainWindow):
def _deckLoadingState(self, oldState):
"Run once, when deck is loaded."
- runHook("deckLoading", self.deck)
self.enableDeckMenuItems()
+ # ensure cwd is set if media dir exists
+ self.deck.media.dir()
+ runHook("deckLoading", self.deck)
self.moveToState("overview")
def _deckClosingState(self, oldState):
@@ -153,7 +155,7 @@ class AnkiQt(QMainWindow):
sharedCSS = """
body {
background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#bbb));
-margin: 1em; }
+margin: 2em; }
a:hover { background-color: #aaa; }
.but { font-size: 80%; padding: 3; background-color: #ccc;
border-radius: 5px; color: #000; margin: 0 5 0 5; text-decoration:
diff --git a/aqt/overview.py b/aqt/overview.py
index 685ba0c9e..14c9b239b 100644
--- a/aqt/overview.py
+++ b/aqt/overview.py
@@ -116,7 +116,7 @@ $(function () {
buf += "
| %s | " % _("Due")
buf += "%s | |
" % _("New")
line = "%s | %s | "
- line += "%s | %s |
"
+ line += "%s | %s | "
buf += line % (
"%s" % _("Selected Groups"),
counts[0], counts[1],
diff --git a/aqt/reviewer.py b/aqt/reviewer.py
index ed69cd350..0a40a79a8 100644
--- a/aqt/reviewer.py
+++ b/aqt/reviewer.py
@@ -40,6 +40,7 @@ class Reviewer(object):
if c:
self.mw.enableCardMenuItems()
self._maybeEnableSound()
+ #self.updateMarkAction()
self._showQuestion()
else:
self.mw.disableCardMenuItems()
@@ -62,7 +63,7 @@ class Reviewer(object):
_css = """
a.ansbut {
display: block; position: fixed;
- bottom: 5px; width: 250px; left: 50%; margin-left: -125px;
+ bottom: 1em; width: 250px; left: 50%; margin-left: -125px;
height: 40px; background-color: #ccc;
border-radius: 5px;
text-align: center;
@@ -72,7 +73,7 @@ a.ansbut {
}
a.ansbut:focus {
-border: 1px solid #333; border-radius: 5px;
+background: #c7c7c7;
}
div.ansbut {
position: relative; top: 25%;
@@ -86,7 +87,7 @@ div#filler {
# we want to include enough space at the bottom to allow for the
# answer buttons
buf = ""
- self.web.stdHtml(text+buf, self._styles(), bodyClass=card.bgClass())
+ self.web.stdHtml(text+buf, self._styles(), bodyClass=card.cssClass())
def _styles(self):
css = self.mw.sharedCSS
@@ -117,6 +118,7 @@ div#filler {
q=mungeQA(q),
but=self._questionButtons())
self._renderQA(c, buf)
+ runHook('showQuestion')
# Question buttons
##########################################################################
@@ -129,50 +131,25 @@ div#filler {
""" % _("Show Answer")
return buf
- # Q/A support
- ##########################################################################
-
- def _showQuestionState(self, oldState):
- # ensure cwd set to media dir
- self.deck.mediaDir()
- self.showAnswerButton()
- self.updateMarkAction()
- runHook('showQuestion')
-
# Showing the answer
##########################################################################
- # elif self.state == "showAnswer":
- # self.setBackground()
- # if not self.card.cardModel.questionInAnswer:
- # self.drawQuestion(nosound=True)
- # if self.drawRule:
- # self.write("
")
- # self.drawAnswer()
-
-
- def _showAnswerState(self, oldState):
- self.showEaseButtons()
-
- def drawAnswer(self):
- "Show the answer."
- a = self.card.htmlAnswer()
- a = runFilter("drawAnswer", a, self.card)
- if self.card.cardModel.typeAnswer:
- try:
- cor = stripMedia(stripHTML(self.card.fact[
- self.card.cardModel.typeAnswer]))
- except KeyError:
- self.card.cardModel.typeAnswer = ""
- cor = ""
- if cor:
- given = unicode(self.main.typeAnswerField.text())
- res = self.correct(cor, given)
- a = res + "
" + a
- self.write(self.center(''
- + mungeQA(a)))
- if self.state != self.oldState and self.main.config['autoplaySounds']:
+ def _showAnswer(self):
+ c = self.card
+ # original question with sounds
+ q = c.a()
+ if self.mw.config['autoplaySounds']:
playFromText(a)
+ # render
+ buf = self._qHtml % dict(
+ q=mungeQA(a),
+ but=self._answerButtons())
+ self._renderQA(c, buf)
+ runHook('showQuestion')
+
+ # buf = self.typeAnsResult()
+ # self.write(self.center(''
+ # + mungeQA(a)))
def onLoadFinished(self, bool):
if self.state == "showAnswer":
@@ -270,6 +247,18 @@ div#filler {
passedCharColour = "#00FF00"
futureWarningColour = "#FF0000"
+ # if self.card.cardModel.typeAnswer:
+ # try:
+ # cor = stripMedia(stripHTML(self.card.fact[
+ # self.card.cardModel.typeAnswer]))
+ # except KeyError:
+ # self.card.cardModel.typeAnswer = ""
+ # cor = ""
+ # if cor:
+ # given = unicode(self.main.typeAnswerField.text())
+ # res = self.correct(cor, given)
+ # a = res + "
" + a
+
# fixme: type answer undo area shouldn't trigger global shortcut
# class QLineEditNoUndo(QLineEdit):
# def __init__(self, parent):