mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
apply same filters in preview
This commit is contained in:
parent
42a4c21d9c
commit
1d1ed411f7
1 changed files with 9 additions and 6 deletions
|
@ -13,7 +13,7 @@ import anki.sound
|
||||||
from ankiqt import ui
|
from ankiqt import ui
|
||||||
import ankiqt
|
import ankiqt
|
||||||
from ankiqt.ui.utils import mungeQA, saveGeom, restoreGeom, getBase
|
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 sqlalchemy.exceptions import InvalidRequestError
|
||||||
from PyQt4 import pyqtconfig
|
from PyQt4 import pyqtconfig
|
||||||
QtConfig = pyqtconfig.Configuration()
|
QtConfig = pyqtconfig.Configuration()
|
||||||
|
@ -1048,14 +1048,17 @@ class PreviewDialog(QDialog):
|
||||||
|
|
||||||
def updateCard(self):
|
def updateCard(self):
|
||||||
c = self.cards[self.currentCard]
|
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(
|
self.dialog.webView.setHtml(
|
||||||
('<html><head>%s</head><body>' % getBase(self.deck)) +
|
('<html><head>%s</head><body>' % getBase(self.deck)) +
|
||||||
"<style>" + self.deck.css +
|
"<style>" + styles + "</style>" +
|
||||||
("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
|
runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion())) +
|
||||||
"\ndiv { white-space: pre-wrap; }</style>" +
|
|
||||||
mungeQA(self.deck, c.htmlQuestion()) +
|
|
||||||
"<br><br><hr><br><br>" +
|
"<br><br><hr><br><br>" +
|
||||||
mungeQA(self.deck, c.htmlAnswer()) + "</body></html>")
|
runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()))
|
||||||
|
+ "</body></html>")
|
||||||
playFromText(c.question)
|
playFromText(c.question)
|
||||||
playFromText(c.answer)
|
playFromText(c.answer)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue