From b81a64272eadee870a6ce6d012b503f799eb45b3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 29 Jul 2017 16:09:00 +1000 Subject: [PATCH] allow browser override font to be unset --- aqt/clayout.py | 10 ++++++++-- designer/browserdisp.ui | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/aqt/clayout.py b/aqt/clayout.py index 71614d0c6..87e138adc 100644 --- a/aqt/clayout.py +++ b/aqt/clayout.py @@ -358,6 +358,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', "")) + if t.get("bfont"): + f.overrideFont.setChecked(True) f.font.setCurrentFont(QFont(t.get('bfont', "Arial"))) f.fontSize.setValue(t.get('bsize', 12)) f.buttonBox.accepted.connect(lambda: self.onBrowserDisplayOk(f)) @@ -367,8 +369,12 @@ 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() + if f.overrideFont.isChecked(): + t['bfont'] = f.font.currentFont().family() + t['bsize'] = f.fontSize.value() + else: + del t['bfont'] + del t['bsize'] def onTargetDeck(self): from aqt.tagedit import TagEdit diff --git a/designer/browserdisp.ui b/designer/browserdisp.ui index 759c76a3d..3a8118255 100644 --- a/designer/browserdisp.ui +++ b/designer/browserdisp.ui @@ -35,7 +35,7 @@ - + Override font: