From 1d1ed411f7d9ca263c259033dfe4ce834dcc52b4 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 12 Jun 2009 20:43:03 +0900 Subject: [PATCH] apply same filters in preview --- ankiqt/ui/facteditor.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index 12e8aa4fc..e02ad3c59 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -13,7 +13,7 @@ import anki.sound from ankiqt import ui import ankiqt from ankiqt.ui.utils import mungeQA, saveGeom, restoreGeom, getBase -from anki.hooks import addHook, removeHook, runHook +from anki.hooks import addHook, removeHook, runHook, runFilter from sqlalchemy.exceptions import InvalidRequestError from PyQt4 import pyqtconfig QtConfig = pyqtconfig.Configuration() @@ -1048,14 +1048,17 @@ class PreviewDialog(QDialog): def updateCard(self): c = self.cards[self.currentCard] + styles = (self.deck.css + + ("\nhtml { background: %s }" % c.cardModel.lastFontColour) + + "\ndiv { white-space: pre-wrap; }") + styles = runFilter("addStyles", styles) self.dialog.webView.setHtml( ('%s' % getBase(self.deck)) + - "" + - mungeQA(self.deck, c.htmlQuestion()) + + "" + + runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion())) + "




" + - mungeQA(self.deck, c.htmlAnswer()) + "") + runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer())) + + "") playFromText(c.question) playFromText(c.answer)