Remove button to toggle search result highlighting from next to the search bar, as too many people click it accidentally and then dont realize what they have done. The button can be restored via Preferences->Searching

This commit is contained in:
Kovid Goyal 2013-11-13 21:00:22 +05:30
parent 98c5739a07
commit 29430b2abd
4 changed files with 136 additions and 123 deletions

View File

@ -120,6 +120,7 @@ defs['cover_grid_disk_cache_size'] = 2500
defs['cover_grid_show_title'] = False defs['cover_grid_show_title'] = False
defs['cover_grid_texture'] = None defs['cover_grid_texture'] = None
defs['show_vl_tabs'] = False defs['show_vl_tabs'] = False
defs['show_highlight_toggle_button'] = False
del defs del defs
# }}} # }}}

View File

@ -10,7 +10,7 @@ from PyQt4.Qt import QApplication
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \
CommaSeparatedList CommaSeparatedList
from calibre.gui2.preferences.search_ui import Ui_Form from calibre.gui2.preferences.search_ui import Ui_Form
from calibre.gui2 import config, error_dialog from calibre.gui2 import config, error_dialog, gprefs
from calibre.utils.config import prefs from calibre.utils.config import prefs
from calibre.utils.icu import sort_key from calibre.utils.icu import sort_key
from calibre.library.caches import set_use_primary_find_in_search from calibre.library.caches import set_use_primary_find_in_search
@ -26,6 +26,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
r('search_as_you_type', config) r('search_as_you_type', config)
r('highlight_search_matches', config) r('highlight_search_matches', config)
r('show_highlight_toggle_button', gprefs)
r('limit_search_columns', prefs) r('limit_search_columns', prefs)
r('use_primary_find_in_search', prefs) r('use_primary_find_in_search', prefs)
r('limit_search_columns_to', prefs, setting=CommaSeparatedList) r('limit_search_columns_to', prefs, setting=CommaSeparatedList)

View File

@ -14,28 +14,7 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="opt_search_as_you_type">
<property name="text">
<string>Search as you &amp;type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="opt_use_primary_find_in_search">
<property name="text">
<string>Unaccented characters match accented characters</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="opt_highlight_search_matches">
<property name="text">
<string>&amp;Highlight search results instead of restricting the book list to the results</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>What to search by default</string> <string>What to search by default</string>
@ -84,7 +63,133 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="8" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox22">
<property name="title">
<string>What to search when searching similar books</string>
</property>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;p&gt;When you search for similar books by right clicking the
book and selecting &quot;Similar books...&quot;,
calibre constructs a search using the column lookup names specified below.
By changing the lookup name to a grouped search term you can
search multiple columns at once.&lt;/p&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_221">
<property name="text">
<string>Similar authors: </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="similar_authors_search_key">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="opt_similar_authors_match_kind"/>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_222">
<property name="text">
<string>Similar series: </string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QComboBox" name="similar_series_search_key">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QComboBox" name="opt_similar_series_match_kind"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_223">
<property name="text">
<string>Similar tags: </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="similar_tags_search_key"/>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="opt_similar_tags_match_kind"/>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_224">
<property name="text">
<string>Similar publishers: </string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QComboBox" name="similar_publisher_search_key"/>
</item>
<item row="2" column="5">
<widget class="QComboBox" name="opt_similar_publisher_match_kind"/>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QPushButton" name="clear_history_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Clear search histories from all over calibre. Including the book list, e-book viewer, fetch news dialog, etc.</string>
</property>
<property name="text">
<string>Clear search &amp;histories</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="opt_search_as_you_type">
<property name="text">
<string>Search as you &amp;type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="opt_use_primary_find_in_search">
<property name="text">
<string>Unaccented characters match accented characters</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="opt_highlight_search_matches">
<property name="text">
<string>&amp;Highlight search results instead of restricting the book list to the results</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Grouped Search Terms</string> <string>Grouped Search Terms</string>
@ -198,111 +303,16 @@ to be shown as user categories</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QPushButton" name="clear_history_button"> <widget class="QCheckBox" name="opt_show_highlight_toggle_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Clear search histories from all over calibre. Including the book list, e-book viewer, fetch news dialog, etc.</string> <string>&lt;p&gt;This option will cause a small button to appear next to the search bar. Clicking the button will toggle between showing only the search results and showing all books with the search results highlighted.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Clear search &amp;histories</string> <string>Show a quick &amp;toggle button to switch between highlighting and restricting results next to the searchbar</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox22">
<property name="title">
<string>What to search when searching similar books</string>
</property>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;p&gt;When you search for similar books by right clicking the
book and selecting &quot;Similar books...&quot;,
calibre constructs a search using the column lookup names specified below.
By changing the lookup name to a grouped search term you can
search multiple columns at once.&lt;/p&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_221">
<property name="text">
<string>Similar authors: </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="similar_authors_search_key">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="opt_similar_authors_match_kind"/>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_222">
<property name="text">
<string>Similar series: </string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QComboBox" name="similar_series_search_key">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QComboBox" name="opt_similar_series_match_kind"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_223">
<property name="text">
<string>Similar tags: </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="similar_tags_search_key"/>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="opt_similar_tags_match_kind"/>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_224">
<property name="text">
<string>Similar publishers: </string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QComboBox" name="similar_publisher_search_key"/>
</item>
<item row="2" column="5">
<widget class="QComboBox" name="opt_similar_publisher_match_kind"/>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

View File

@ -14,7 +14,7 @@ from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, QDialog, \
pyqtSignal, QCompleter, QAction, QKeySequence, QTimer, \ pyqtSignal, QCompleter, QAction, QKeySequence, QTimer, \
QString, QIcon, QMenu QString, QIcon, QMenu
from calibre.gui2 import config, error_dialog, question_dialog from calibre.gui2 import config, error_dialog, question_dialog, gprefs
from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.confirm_delete import confirm
from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor
from calibre.gui2.dialogs.search import SearchDialog from calibre.gui2.dialogs.search import SearchDialog
@ -435,6 +435,7 @@ class SearchBoxMixin(object): # {{{
self.highlight_only_button.setIcon(QIcon(I('highlight_only_on.png'))) self.highlight_only_button.setIcon(QIcon(I('highlight_only_on.png')))
else: else:
self.highlight_only_button.setIcon(QIcon(I('highlight_only_off.png'))) self.highlight_only_button.setIcon(QIcon(I('highlight_only_off.png')))
self.highlight_only_button.setVisible(gprefs['show_highlight_toggle_button'])
self.library_view.model().set_highlight_only(config['highlight_search_matches']) self.library_view.model().set_highlight_only(config['highlight_search_matches'])
def focus_search_box(self, *args): def focus_search_box(self, *args):