mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
add a browser options dialog so the user can toggle full search
This commit is contained in:
parent
28c1741b43
commit
4fa0a68dd3
5 changed files with 159 additions and 142 deletions
|
@ -346,7 +346,7 @@ class Browser(QMainWindow):
|
||||||
c(f.actionToggleSuspend, SIGNAL("triggered(bool)"), self.onSuspend)
|
c(f.actionToggleSuspend, SIGNAL("triggered(bool)"), self.onSuspend)
|
||||||
c(f.actionToggleMark, SIGNAL("triggered(bool)"), self.onMark)
|
c(f.actionToggleMark, SIGNAL("triggered(bool)"), self.onMark)
|
||||||
# edit
|
# edit
|
||||||
c(f.actionFont, s, self.onFont)
|
c(f.actionOptions, s, self.onOptions)
|
||||||
c(f.actionUndo, s, self.mw.onUndo)
|
c(f.actionUndo, s, self.mw.onUndo)
|
||||||
c(f.actionInvertSelection, s, self.invertSelection)
|
c(f.actionInvertSelection, s, self.invertSelection)
|
||||||
c(f.actionSelectFacts, s, self.selectFacts)
|
c(f.actionSelectFacts, s, self.selectFacts)
|
||||||
|
@ -907,17 +907,18 @@ where id in %s""" % ids2str(sf))
|
||||||
else:
|
else:
|
||||||
self.form.actionUndo.setEnabled(False)
|
self.form.actionUndo.setEnabled(False)
|
||||||
|
|
||||||
# Edit: font
|
# Options
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def onFont(self):
|
def onOptions(self):
|
||||||
d = QDialog(self)
|
d = QDialog(self)
|
||||||
frm = aqt.forms.editfont.Ui_Dialog()
|
frm = aqt.forms.browseropts.Ui_Dialog()
|
||||||
frm.setupUi(d)
|
frm.setupUi(d)
|
||||||
frm.fontCombo.setCurrentFont(QFont(
|
frm.fontCombo.setCurrentFont(QFont(
|
||||||
self.mw.config['editFontFamily']))
|
self.mw.config['editFontFamily']))
|
||||||
frm.fontSize.setValue(self.mw.config['editFontSize'])
|
frm.fontSize.setValue(self.mw.config['editFontSize'])
|
||||||
frm.lineSize.setValue(self.mw.config['editLineSize'])
|
frm.lineSize.setValue(self.mw.config['editLineSize'])
|
||||||
|
frm.fullSearch.setChecked(self.mw.config['fullSearch'])
|
||||||
if d.exec_():
|
if d.exec_():
|
||||||
self.mw.config['editFontFamily'] = (
|
self.mw.config['editFontFamily'] = (
|
||||||
unicode(frm.fontCombo.currentFont().family()))
|
unicode(frm.fontCombo.currentFont().family()))
|
||||||
|
@ -925,6 +926,7 @@ where id in %s""" % ids2str(sf))
|
||||||
int(frm.fontSize.value()))
|
int(frm.fontSize.value()))
|
||||||
self.mw.config['editLineSize'] = (
|
self.mw.config['editLineSize'] = (
|
||||||
int(frm.lineSize.value()))
|
int(frm.lineSize.value()))
|
||||||
|
self.mw.config['fullSearch'] = frm.fullSearch.isChecked()
|
||||||
self.updateFont()
|
self.updateFont()
|
||||||
|
|
||||||
# Edit: replacing
|
# Edit: replacing
|
||||||
|
|
|
@ -20,8 +20,8 @@ defaultConf = {
|
||||||
'factEditorAdvanced': False,
|
'factEditorAdvanced': False,
|
||||||
'showStudyScreen': True,
|
'showStudyScreen': True,
|
||||||
|
|
||||||
'recentDeckPaths': [],
|
|
||||||
'interfaceLang': "en",
|
'interfaceLang': "en",
|
||||||
|
'fullSearch': False,
|
||||||
|
|
||||||
'autoplaySounds': True,
|
'autoplaySounds': True,
|
||||||
'checkForUpdates': True,
|
'checkForUpdates': True,
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
<addaction name="actionFindReplace"/>
|
<addaction name="actionFindReplace"/>
|
||||||
<addaction name="actionFindDuplicates"/>
|
<addaction name="actionFindDuplicates"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFont"/>
|
<addaction name="actionOptions"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuActions">
|
<widget class="QMenu" name="menuActions">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -448,9 +448,9 @@
|
||||||
<string>&Cram...</string>
|
<string>&Cram...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionFont">
|
<action name="actionOptions">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Font...</string>
|
<string>Browser Options...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSuspend">
|
<action name="actionSuspend">
|
||||||
|
|
149
designer/browseropts.ui
Normal file
149
designer/browseropts.ui
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>288</width>
|
||||||
|
<height>195</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Browser Options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Font</b>:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFontComboBox" name="fontCombo"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Font Size</b>:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="fontSize">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Line Size</b>:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="lineSize"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="fullSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Search within formatting (slow)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>fontCombo</tabstop>
|
||||||
|
<tabstop>fontSize</tabstop>
|
||||||
|
<tabstop>lineSize</tabstop>
|
||||||
|
<tabstop>fullSearch</tabstop>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>Dialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>Dialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -1,134 +0,0 @@
|
||||||
<ui version="4.0" >
|
|
||||||
<class>Dialog</class>
|
|
||||||
<widget class="QDialog" name="Dialog" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>205</width>
|
|
||||||
<height>139</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle" >
|
|
||||||
<string>Browser Font</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label" >
|
|
||||||
<property name="text" >
|
|
||||||
<string><b>Font</b>:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFontComboBox" name="fontCombo" />
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QLabel" name="label_2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string><b>Font Size</b>:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<widget class="QSpinBox" name="fontSize" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QLabel" name="label_3" >
|
|
||||||
<property name="text" >
|
|
||||||
<string><b>Line Size</b>:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QSpinBox" name="lineSize" />
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" >
|
|
||||||
<spacer name="horizontalSpacer_2" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons" >
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>Dialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel" >
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel" >
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>Dialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel" >
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel" >
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
Loading…
Reference in a new issue