support videos, pass current card to style gen, tweak q/a size when q hidden

This commit is contained in:
Damien Elmes 2009-06-15 11:38:16 +09:00
parent 2f8508d13a
commit 12c1590d3f
2 changed files with 6 additions and 4 deletions

View file

@ -242,7 +242,7 @@ class FactEditor(object):
self.addSound.setShortcut(_("F4"))
self.addSound.setEnabled(False)
self.addSound.setIcon(QIcon(":/icons/text-speak.png"))
self.addSound.setToolTip(_("Add audio (F4)"))
self.addSound.setToolTip(_("Add audio/video (F4)"))
self.iconsBox.addWidget(self.addSound)
self.addSound.setStyle(self.plastiqueStyle)
# sounds
@ -870,7 +870,7 @@ class FactEditor(object):
def onAddSound(self):
# get this before we open the dialog
w = self.focusedEdit()
key = _("Sounds (*.mp3 *.ogg *.wav)")
key = _("Sounds/Videos (*.mp3 *.ogg *.wav *.avi *.ogv *.mpg *.mpeg)")
file = ui.utils.getFile(self.parent, _("Add audio"), "audio", key)
if not file:
return
@ -1051,7 +1051,7 @@ class PreviewDialog(QDialog):
styles = (self.deck.css +
("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
"\ndiv { white-space: pre-wrap; }")
styles = runFilter("addStyles", styles)
styles = runFilter("addStyles", styles, c)
self.dialog.webView.setHtml(
('<html><head>%s</head><body>' % getBase(self.deck)) +
"<style>" + styles + "</style>" +

View file

@ -87,7 +87,7 @@ class View(object):
if self.main.deck:
s += self.main.deck.css
s += "div { white-space: pre-wrap; }\n"
s = runFilter("addStyles", s)
s = runFilter("addStyles", s, self.main.currentCard)
s += "</style>"
return s
@ -135,6 +135,8 @@ class View(object):
q = self.main.currentCard.htmlQuestion()
if self.haveTop:
height = 35
elif self.main.currentCard.cardModel.questionInAnswer:
height = 40
else:
height = 45
q = runFilter("drawQuestion", q, self.main.currentCard)