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.setShortcut(_("F4"))
self.addSound.setEnabled(False) self.addSound.setEnabled(False)
self.addSound.setIcon(QIcon(":/icons/text-speak.png")) 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.iconsBox.addWidget(self.addSound)
self.addSound.setStyle(self.plastiqueStyle) self.addSound.setStyle(self.plastiqueStyle)
# sounds # sounds
@ -870,7 +870,7 @@ class FactEditor(object):
def onAddSound(self): def onAddSound(self):
# get this before we open the dialog # get this before we open the dialog
w = self.focusedEdit() 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) file = ui.utils.getFile(self.parent, _("Add audio"), "audio", key)
if not file: if not file:
return return
@ -1051,7 +1051,7 @@ class PreviewDialog(QDialog):
styles = (self.deck.css + styles = (self.deck.css +
("\nhtml { background: %s }" % c.cardModel.lastFontColour) + ("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
"\ndiv { white-space: pre-wrap; }") "\ndiv { white-space: pre-wrap; }")
styles = runFilter("addStyles", styles) styles = runFilter("addStyles", styles, c)
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>" + styles + "</style>" + "<style>" + styles + "</style>" +

View file

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