From 4fa0a68dd3f10b6c6d3b1fabe26d50b31f7d461b Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 17 Apr 2011 08:11:24 +0900 Subject: [PATCH] add a browser options dialog so the user can toggle full search --- aqt/browser.py | 10 +-- aqt/config.py | 2 +- designer/browser.ui | 6 +- designer/browseropts.ui | 149 ++++++++++++++++++++++++++++++++++++++++ designer/editfont.ui | 134 ------------------------------------ 5 files changed, 159 insertions(+), 142 deletions(-) create mode 100644 designer/browseropts.ui delete mode 100644 designer/editfont.ui diff --git a/aqt/browser.py b/aqt/browser.py index 465c96498..2f82dae4f 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -346,7 +346,7 @@ class Browser(QMainWindow): c(f.actionToggleSuspend, SIGNAL("triggered(bool)"), self.onSuspend) c(f.actionToggleMark, SIGNAL("triggered(bool)"), self.onMark) # edit - c(f.actionFont, s, self.onFont) + c(f.actionOptions, s, self.onOptions) c(f.actionUndo, s, self.mw.onUndo) c(f.actionInvertSelection, s, self.invertSelection) c(f.actionSelectFacts, s, self.selectFacts) @@ -907,17 +907,18 @@ where id in %s""" % ids2str(sf)) else: self.form.actionUndo.setEnabled(False) - # Edit: font + # Options ###################################################################### - def onFont(self): + def onOptions(self): d = QDialog(self) - frm = aqt.forms.editfont.Ui_Dialog() + frm = aqt.forms.browseropts.Ui_Dialog() frm.setupUi(d) frm.fontCombo.setCurrentFont(QFont( self.mw.config['editFontFamily'])) frm.fontSize.setValue(self.mw.config['editFontSize']) frm.lineSize.setValue(self.mw.config['editLineSize']) + frm.fullSearch.setChecked(self.mw.config['fullSearch']) if d.exec_(): self.mw.config['editFontFamily'] = ( unicode(frm.fontCombo.currentFont().family())) @@ -925,6 +926,7 @@ where id in %s""" % ids2str(sf)) int(frm.fontSize.value())) self.mw.config['editLineSize'] = ( int(frm.lineSize.value())) + self.mw.config['fullSearch'] = frm.fullSearch.isChecked() self.updateFont() # Edit: replacing diff --git a/aqt/config.py b/aqt/config.py index d704225b5..97dc29884 100644 --- a/aqt/config.py +++ b/aqt/config.py @@ -20,8 +20,8 @@ defaultConf = { 'factEditorAdvanced': False, 'showStudyScreen': True, - 'recentDeckPaths': [], 'interfaceLang': "en", + 'fullSearch': False, 'autoplaySounds': True, 'checkForUpdates': True, diff --git a/designer/browser.ui b/designer/browser.ui index f04ea7535..98c42c963 100644 --- a/designer/browser.ui +++ b/designer/browser.ui @@ -202,7 +202,7 @@ - + @@ -448,9 +448,9 @@ &Cram... - + - Font... + Browser Options... diff --git a/designer/browseropts.ui b/designer/browseropts.ui new file mode 100644 index 000000000..e139ff035 --- /dev/null +++ b/designer/browseropts.ui @@ -0,0 +1,149 @@ + + + Dialog + + + + 0 + 0 + 288 + 195 + + + + Browser Options + + + + + + + + <b>Font</b>: + + + + + + + + + + + + + + <b>Font Size</b>: + + + + + + + + 75 + 0 + + + + + + + + <b>Line Size</b>: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Search within formatting (slow) + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + fontCombo + fontSize + lineSize + fullSearch + buttonBox + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/designer/editfont.ui b/designer/editfont.ui deleted file mode 100644 index b16447494..000000000 --- a/designer/editfont.ui +++ /dev/null @@ -1,134 +0,0 @@ - - Dialog - - - - 0 - 0 - 205 - 139 - - - - Browser Font - - - - - - - - <b>Font</b>: - - - - - - - - - - - - - - <b>Font Size</b>: - - - - - - - - 75 - 0 - - - - - - - - <b>Line Size</b>: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -