diff --git a/anki/models.py b/anki/models.py index ca8fb47cf..6e8ea5fe3 100644 --- a/anki/models.py +++ b/anki/models.py @@ -62,6 +62,8 @@ defaultTemplate = { 'did': None, 'bqfmt': "", 'bafmt': "", + 'bfont': "Arial", + 'bsize': 12, } class ModelManager(object): diff --git a/aqt/browser.py b/aqt/browser.py index 483d106c4..522e408a9 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -64,8 +64,17 @@ class DataModel(QAbstractTableModel): if not index.isValid(): return if role == Qt.FontRole: - return - if role == Qt.TextAlignmentRole: + if self.activeCols[index.column()] not in ( + "question", "answer", "noteFld"): + return + f = QFont() + row = index.row() + c = self.getCard(index) + t = c.template() + f.setFamily(t.get("bfont", "Arial")) + f.setPixelSize(t.get("bsize", 12)) + return f + elif role == Qt.TextAlignmentRole: align = Qt.AlignVCenter if self.activeCols[index.column()] not in ("question", "answer", "template", "deck", "noteFld", "note"): diff --git a/aqt/clayout.py b/aqt/clayout.py index 42df92084..0160741ac 100644 --- a/aqt/clayout.py +++ b/aqt/clayout.py @@ -320,7 +320,7 @@ adjust the template manually to switch the question and answer.""")) a = m.addAction(_("Deck Override") + s) a.connect(a, SIGNAL("triggered()"), self.onTargetDeck) - a = m.addAction(_("Column Templates")) + a = m.addAction(_("Browser Appearance")) a.connect(a, SIGNAL("triggered()"), self.onBrowserDisplay) if self.model['type'] != MODEL_CLOZE: @@ -336,6 +336,8 @@ adjust the template manually to switch the question and answer.""")) t = self.card.template() f.qfmt.setText(t.get('bqfmt', "")) f.afmt.setText(t.get('bafmt', "")) + f.font.setCurrentFont(QFont(t.get('bfont', "Arial"))) + f.fontSize.setValue(t.get('bsize', 12)) d.connect(f.buttonBox, SIGNAL("accepted()"), lambda: self.onBrowserDisplayOk(f)) d.exec_() @@ -344,6 +346,8 @@ adjust the template manually to switch the question and answer.""")) t = self.card.template() t['bqfmt'] = f.qfmt.text().strip() t['bafmt'] = f.afmt.text().strip() + t['bfont'] = f.font.currentFont().family() + t['bsize'] = f.fontSize.value() def onTargetDeck(self): from aqt.tagedit import TagEdit diff --git a/designer/browserdisp.ui b/designer/browserdisp.ui index 1f5a869e2..1f9405bc6 100644 --- a/designer/browserdisp.ui +++ b/designer/browserdisp.ui @@ -7,17 +7,17 @@ 0 0 412 - 204 + 241 - Column Templates + Browser Appearance - Template for front column in browser: + Override front template: @@ -27,13 +27,44 @@ - Template for back column in browser: + Override back template: + + + + Override font: + + + + + + + + + + 5 + 0 + + + + + + + + 6 + + + 18 + + + + + @@ -62,6 +93,8 @@ qfmt afmt + font + fontSize buttonBox