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):
|
def saveCard(self):
|
||||||
if self.updatingCards:
|
if self.updatingCards:
|
||||||
return
|
return
|
||||||
card = self.card.cardModel
|
t = self.card.template()
|
||||||
card.questionAlign = self.form.alignment.currentIndex()
|
t['align'] = self.form.alignment.currentIndex()
|
||||||
card.lastFontColour = unicode(
|
t['bg'] = unicode(
|
||||||
self.form.background.palette().window().color().name())
|
self.form.background.palette().window().color().name())
|
||||||
card.questionInAnswer = self.form.questionInAnswer.isChecked()
|
t['hideQ'] = self.form.questionInAnswer.isChecked()
|
||||||
card.allowEmptyAnswer = self.form.allowEmptyAnswer.isChecked()
|
t['emptyAns'] = self.form.allowEmptyAnswer.isChecked()
|
||||||
idx = self.form.typeAnswer.currentIndex()
|
idx = self.form.typeAnswer.currentIndex()
|
||||||
if not idx:
|
if not idx:
|
||||||
card.typeAnswer = u""
|
t['typeAns'] = None
|
||||||
else:
|
else:
|
||||||
card.typeAnswer = self.typeFieldNames[idx-1]
|
t['typeAns'] = idx-1
|
||||||
card.model.setModified()
|
|
||||||
self.deck.flushMod()
|
|
||||||
self.renderPreview()
|
self.renderPreview()
|
||||||
|
|
||||||
def chooseColour(self, button, type="field"):
|
def chooseColour(self, button, type="field"):
|
||||||
|
@ -214,9 +212,11 @@ class CardLayout(QDialog):
|
||||||
c = self.card
|
c = self.card
|
||||||
styles = self.model.genCSS()
|
styles = self.model.genCSS()
|
||||||
self.form.preview.setHtml(
|
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>" +
|
"<style>" + styles + "</style>" +
|
||||||
mungeQA(c.q(reload=True)) +
|
mungeQA(c.q(reload=True)) +
|
||||||
|
self.maybeTextInput() +
|
||||||
"<hr>" +
|
"<hr>" +
|
||||||
mungeQA(c.a())
|
mungeQA(c.a())
|
||||||
+ "</body></html>")
|
+ "</body></html>")
|
||||||
|
@ -226,8 +226,14 @@ class CardLayout(QDialog):
|
||||||
playFromText(c.a())
|
playFromText(c.a())
|
||||||
self.playedAudio[c.id] = True
|
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):
|
def reject(self):
|
||||||
return
|
return QDialog.reject(self)
|
||||||
|
|
||||||
self.fact.model.setModified()
|
self.fact.model.setModified()
|
||||||
|
|
||||||
modified = False
|
modified = False
|
||||||
|
|
Loading…
Reference in a new issue