diff --git a/ankiqt/ui/displayproperties.py b/ankiqt/ui/displayproperties.py
index 80d0589fe..8f75f337e 100644
--- a/ankiqt/ui/displayproperties.py
+++ b/ankiqt/ui/displayproperties.py
@@ -68,7 +68,7 @@ class DisplayProperties(QDialog):
self.main.config['showFontPreview'] = True
else:
self.dialog.previewGroup.hide()
- self.setFixedWidth(340)
+ self.setFixedWidth(380)
self.main.config['showFontPreview'] = False
def setupCards(self):
@@ -86,10 +86,18 @@ class DisplayProperties(QDialog):
w.setStyle(self.plastiqueStyle)
self.connect(w,
SIGNAL("clicked()"),
- lambda w=w, t=type: self.chooseColour(w, t))
+ lambda w=w: self.chooseColour(w))
self.connect(self.cwidget("Align", type),
SIGNAL("activated(int)"),
self.saveCard)
+ # background colour
+ self.connect(self.dialog.backgroundColour,
+ SIGNAL("clicked()"),
+ lambda w=self.dialog.backgroundColour:\
+ self.chooseColour(w))
+ if self.plastiqueStyle:
+ self.dialog.backgroundColour.setStyle(self.plastiqueStyle)
+
self.drawCards()
def drawCards(self):
@@ -119,6 +127,8 @@ class DisplayProperties(QDialog):
getattr(card, type + "FontColour"))))
self.cwidget("Align", type).setCurrentIndex(
getattr(card, type + "Align"))
+ self.dialog.backgroundColour.setPalette(QPalette(QColor(
+ getattr(card, "lastFontColour"))))
self.card = card
def saveCard(self):
@@ -136,6 +146,8 @@ class DisplayProperties(QDialog):
setattr(self.card, type + "FontColour", unicode(c.name()))
self.card.model.setModified()
self.deck.setModified()
+ setattr(self.card, "lastFontColour", unicode(
+ self.dialog.backgroundColour.palette().window().color().name()))
self.drawQuestionAndAnswer()
def cwidget(self, name, type):
@@ -167,7 +179,7 @@ class DisplayProperties(QDialog):
w.setStyle(self.plastiqueStyle)
self.connect(w,
SIGNAL("clicked()"),
- lambda w=w, t=type: self.chooseColour(w, t))
+ lambda w=w: self.chooseColour(w))
self.currentField = None
self.drawFields()
@@ -260,7 +272,7 @@ class DisplayProperties(QDialog):
self.deck.flushMod()
self.drawQuestionAndAnswer()
- def chooseColour(self, button, type):
+ def chooseColour(self, button):
new = QColorDialog.getColor(button.palette().window().color(), self)
if new.isValid():
button.setPalette(QPalette(new))
@@ -275,14 +287,16 @@ class DisplayProperties(QDialog):
f[field.name] = field.name
f.model = self.model
c = Card(f, self.card)
- t = "
" + c.htmlQuestion() + ""
+ t = "
" + c.htmlQuestion() + ""
+ bg = "body { background-color: %s; }\n" % self.card.lastFontColour
self.dialog.question.setText(
- "\n" + t)
- t = "
" + c.htmlAnswer() + ""
+ "\n" + t)
+ t = "
" + c.htmlAnswer() + ""
self.dialog.answer.setText(
- "\n" + t)
+ "\n" + t)
self.main.updateViews(self.main.state)
+
def reject(self):
ui.dialogs.close("DisplayProperties")
QDialog.reject(self)
diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py
index bc31123e5..94239e063 100644
--- a/ankiqt/ui/main.py
+++ b/ankiqt/ui/main.py
@@ -437,12 +437,7 @@ new:
##########################################################################
def setupButtons(self):
- if sys.platform.startswith("darwin"):
- self.easeButtonHeight = 35
- else:
- self.easeButtonHeight = 25
# ask
- self.mainWin.showAnswerButton.setFixedHeight(self.easeButtonHeight)
self.connect(self.mainWin.showAnswerButton, SIGNAL("clicked()"),
lambda: self.moveToState("showAnswer"))
# answer
diff --git a/ankiqt/ui/view.py b/ankiqt/ui/view.py
index 54155d0de..6e85d7069 100644
--- a/ankiqt/ui/view.py
+++ b/ankiqt/ui/view.py
@@ -64,10 +64,12 @@ class View(object):
if self.haveTop:
self.drawTopSection()
if self.state == "showQuestion":
+ self.setBackground()
self.drawQuestion()
if self.drawRule:
self.write("
")
elif self.state == "showAnswer":
+ self.setBackground()
if not self.main.currentCard.cardModel.questionInAnswer:
self.drawQuestion(nosound=True)
if self.drawRule:
@@ -92,6 +94,10 @@ class View(object):
self.body.setHtml("")
self.buffer = ""
+ def setBackground(self):
+ col = self.main.currentCard.cardModel.lastFontColour
+ self.write("" % col)
+
# Font properties & output
##########################################################################
@@ -131,7 +137,7 @@ class View(object):
self.write(self.center(self.mungeQA(self.main.deck, q), height))
if self.state != self.oldState and not nosound:
playFromText(q)
-
+
def correct(self, a, b):
if b == "":
return "";
@@ -144,12 +150,12 @@ class View(object):
passedCharColour, sz)
bad = "background: %s; color: #000; font-size: %dpx;" % (
failedCharColour, sz)
-
+
for tag, i1, i2, j1, j2 in s.get_opcodes():
if tag == "equal":
ret += ("%s" % (ok, b[i1:i2]))
elif tag == "replace":
- ret += ("%s"
+ ret += ("%s"
% (bad, b[i1:i2] + (" " * ((j2 - j1) - (i2 - i1)))))
elif tag == "delete":
ret += ("%s" % (bad, b[i1:i2]))
@@ -157,7 +163,6 @@ class View(object):
ret += ("%s" % (bad, " " * (j2 - j1)))
return ret
-
def drawAnswer(self):
"Show the answer."
a = self.main.currentCard.htmlAnswer()
@@ -171,7 +176,7 @@ class View(object):
given = unicode(self.main.typeAnswerField.text())
res = self.correct(cor, given)
a = res + "
" + a
- self.write(self.center(''
+ self.write(self.center(''
+ self.mungeQA(self.main.deck, a)))
if self.state != self.oldState:
playFromText(a)
@@ -242,7 +247,7 @@ class View(object):
##########################################################################
def drawWelcomeMessage(self):
- self.main.mainWin.welcomeText.setText(_("""
+ self.main.mainWin.welcomeText.setText(_("""\
Welcome to Anki!
diff --git a/designer/displayproperties.ui b/designer/displayproperties.ui
index 0c1d45f5c..e9dc299c6 100644
--- a/designer/displayproperties.ui
+++ b/designer/displayproperties.ui
@@ -5,8 +5,8 @@
0
0
- 763
- 399
+ 818
+ 427
@@ -45,6 +45,18 @@
0
+
+
+ 360
+ 0
+
+
+
+
+ 360
+ 16777215
+
+
QFrame::NoFrame
@@ -84,7 +96,7 @@
-
-
+
0
0
@@ -97,8 +109,8 @@
0
0
- 297
- 289
+ 348
+ 317
@@ -250,20 +262,37 @@
-
-
-
- Qt::Vertical
+
+
+ Background colour
-
-
- 20
- 40
-
+
+
+ -
+
+
+
-
+
+ false
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
@@ -271,8 +300,8 @@
0
0
- 297
- 289
+ 960
+ 480
@@ -558,12 +587,6 @@
0
-
-
- 400
- 0
-
-
true
diff --git a/designer/main.ui b/designer/main.ui
index 80582729c..0ccc383e7 100644
--- a/designer/main.ui
+++ b/designer/main.ui
@@ -6,7 +6,7 @@
0
0
699
- 433
+ 446
@@ -23,6 +23,14 @@
:/icons/anki.png:/icons/anki.png
+
+
+ 0
+ 69
+ 699
+ 357
+
+
1
@@ -115,43 +123,44 @@
QFrame::Raised
-
- 4
-
-
+
0
-
- 4
-
-
- 6
-
0
-
+
+
+ 0
+ 1
+
+
5
+
+
+ 0
+ 0
+ 422
+ 59
+
+
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 1
-
-
-
-
+
+ 4
+
-
+
+
+ 0
+ 0
+
+
0
@@ -169,27 +178,29 @@
+
+
+ 0
+ 0
+ 422
+ 53
+
+
-
- 0
-
0
- 0
+ 4
0
- 6
+ 4
-
-
- 0
-
-
@@ -205,12 +216,22 @@
-
-
- 6
-
0
+
-
+
+
+ Qt::Vertical
+
+
+
+ 55
+ 13
+
+
+
+
-
@@ -291,19 +312,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
@@ -324,6 +332,14 @@
+
+
+ 0
+ 0
+ 422
+ 53
+
+
-
@@ -351,6 +367,14 @@
+
+
+ 0
+ 0
+ 422
+ 53
+
+
-
@@ -385,6 +409,14 @@
+
+
+ 0
+ 0
+ 422
+ 53
+
+
-
@@ -404,23 +436,52 @@
-
+
+
+
+ 0
+ 0
+ 422
+ 53
+
+
+
-
-
+
0
- 99
+ 100
- 0
+ 4
-
+
+
+
+ 0
+ 0
+ 422
+ 304
+
+
+
+
+
+ 0
+ 0
+ 422
+ 304
+
+
+
+ 6
+
-
@@ -434,6 +495,14 @@
+
+
+ 0
+ 0
+ 422
+ 304
+
+
0
@@ -447,6 +516,14 @@
+
+
+ 0
+ 0
+ 422
+ 304
+
+
0
@@ -749,16 +826,46 @@
+
+
+ 0
+ 0
+ 422
+ 304
+
+
-
-
+
+ 6
+
+
-
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 10
+
+
+
+
-
xxx
+
+ 0
+
-
@@ -1029,7 +1136,7 @@
0
0
699
- 25
+ 23
-
+
+
+
+ 0
+ 426
+ 699
+ 20
+
+
+
true
+
+
+ 0
+ 23
+ 699
+ 46
+
+
Qt::Horizontal