mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fixed the rest of the templates tab
This commit is contained in:
parent
2f6867c4cc
commit
96e3cf30aa
1 changed files with 17 additions and 11 deletions
|
@ -184,19 +184,17 @@ class CardLayout(QDialog):
|
|||
def saveCard(self):
|
||||
if self.updatingCards:
|
||||
return
|
||||
card = self.card.cardModel
|
||||
card.questionAlign = self.form.alignment.currentIndex()
|
||||
card.lastFontColour = unicode(
|
||||
t = self.card.template()
|
||||
t['align'] = self.form.alignment.currentIndex()
|
||||
t['bg'] = unicode(
|
||||
self.form.background.palette().window().color().name())
|
||||
card.questionInAnswer = self.form.questionInAnswer.isChecked()
|
||||
card.allowEmptyAnswer = self.form.allowEmptyAnswer.isChecked()
|
||||
t['hideQ'] = self.form.questionInAnswer.isChecked()
|
||||
t['emptyAns'] = self.form.allowEmptyAnswer.isChecked()
|
||||
idx = self.form.typeAnswer.currentIndex()
|
||||
if not idx:
|
||||
card.typeAnswer = u""
|
||||
t['typeAns'] = None
|
||||
else:
|
||||
card.typeAnswer = self.typeFieldNames[idx-1]
|
||||
card.model.setModified()
|
||||
self.deck.flushMod()
|
||||
t['typeAns'] = idx-1
|
||||
self.renderPreview()
|
||||
|
||||
def chooseColour(self, button, type="field"):
|
||||
|
@ -214,9 +212,11 @@ class CardLayout(QDialog):
|
|||
c = self.card
|
||||
styles = self.model.genCSS()
|
||||
self.form.preview.setHtml(
|
||||
('<html><head>%s</head><body>' % getBase(self.deck, c)) +
|
||||
('<html><head>%s</head><body class="%s">' %
|
||||
(getBase(self.deck, c), c.cssClass())) +
|
||||
"<style>" + styles + "</style>" +
|
||||
mungeQA(c.q(reload=True)) +
|
||||
self.maybeTextInput() +
|
||||
"<hr>" +
|
||||
mungeQA(c.a())
|
||||
+ "</body></html>")
|
||||
|
@ -226,8 +226,14 @@ class CardLayout(QDialog):
|
|||
playFromText(c.a())
|
||||
self.playedAudio[c.id] = True
|
||||
|
||||
def maybeTextInput(self):
|
||||
if self.card.template()['typeAns'] is not None:
|
||||
return "<center><input type=text></center>"
|
||||
return ""
|
||||
|
||||
def reject(self):
|
||||
return
|
||||
return QDialog.reject(self)
|
||||
|
||||
self.fact.model.setModified()
|
||||
|
||||
modified = False
|
||||
|
|
Loading…
Reference in a new issue