diff --git a/anki/models.py b/anki/models.py index b8675cadd..0e1d8027c 100644 --- a/anki/models.py +++ b/anki/models.py @@ -53,7 +53,6 @@ defaultTemplate = { 'ord': None, 'qfmt': "", 'afmt': "", - 'hideQ': False, 'align': 0, 'bg': "#fff", 'typeAns': None, @@ -204,39 +203,13 @@ select id from cards where fid in (select id from facts where mid = ?)""", return "\n".join([m['css'] for m in self.all()]) def _css(self, m): - # fields - css = "".join(self._fieldCSS( - ".fm%s-%s" % (hexifyID(m['id']), hexifyID(f['ord'])), - (f['font'], f['qsize'], f['qcol'], f['rtl'], f['pre'])) - for f in m['flds']) # templates - css += "".join(".cm%s-%s {text-align:%s;background:%s}\n" % ( + css = "".join(".cm%s-%s {text-align:%s;background:%s}\n" % ( hexifyID(m['id']), hexifyID(t['ord']), ("center", "left", "right")[t['align']], t['bg']) for t in m['tmpls']) return css - def _rewriteFont(self, font): - "Convert a platform font to a multiplatform list." - font = font.lower() - for family in self.deck.conf['fontFamilies']: - for font2 in family: - if font == font2.lower(): - return ",".join(family) - return font - - def _fieldCSS(self, prefix, row): - (fam, siz, col, rtl, pre) = row - t = 'font-family:"%s";' % self._rewriteFont(fam) - t += 'font-size:%dpx;' % siz - t += 'color:%s;' % col - if rtl: - t += "direction:rtl;unicode-bidi:embed;" - if pre: - t += "white-space:pre-wrap;" - t = "%s {%s}\n" % (prefix, t) - return t - # Fields ################################################## diff --git a/anki/upgrade.py b/anki/upgrade.py index ee3d14af9..b5483a052 100644 --- a/anki/upgrade.py +++ b/anki/upgrade.py @@ -388,11 +388,14 @@ order by ordinal""", mid)): conf['actv'], conf['qfmt'], conf['afmt'], - conf['hideQ'], + hideq, conf['align'], conf['bg'], conf['typeAns']) = row conf['ord'] = c + # q fields now in a + if not hideq: + conf['afmt'] = conf['qfmt'] + "\n\n