This commit is contained in:
Kovid Goyal 2012-07-06 22:11:12 +05:30
commit d1f1e5bb6d
2 changed files with 11 additions and 4 deletions

View File

@ -13,6 +13,7 @@ from calibre.gui2.preferences.search_ui import Ui_Form
from calibre.gui2 import config, error_dialog from calibre.gui2 import config, error_dialog
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
class ConfigWidget(ConfigWidgetBase, Ui_Form): class ConfigWidget(ConfigWidgetBase, Ui_Form):
@ -223,6 +224,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
return ConfigWidgetBase.commit(self) return ConfigWidgetBase.commit(self)
def refresh_gui(self, gui): def refresh_gui(self, gui):
set_use_primary_find_in_search(prefs['use_primary_find_in_search'])
gui.set_highlight_only_button_icon() gui.set_highlight_only_button_icon()
if self.muc_changed: if self.muc_changed:
gui.tags_view.recount() gui.tags_view.recount()

View File

@ -118,10 +118,15 @@ class MetadataBackup(Thread): # {{{
# }}} # }}}
### Global utility function for get_match here and in gui2/library.py
# This is a global for performance # This is a global for performance
pref_use_primary_find_in_search = False pref_use_primary_find_in_search = False
### Global utility function for get_match here and in gui2/library.py def set_use_primary_find_in_search(toWhat):
global pref_use_primary_find_in_search
pref_use_primary_find_in_search = toWhat
CONTAINS_MATCH = 0 CONTAINS_MATCH = 0
EQUALS_MATCH = 1 EQUALS_MATCH = 1
REGEXP_MATCH = 2 REGEXP_MATCH = 2
@ -252,6 +257,9 @@ class ResultCache(SearchQueryParser): # {{{
SearchQueryParser.__init__(self, self.all_search_locations, optimize=True) SearchQueryParser.__init__(self, self.all_search_locations, optimize=True)
self.build_date_relop_dict() self.build_date_relop_dict()
self.build_numeric_relop_dict() self.build_numeric_relop_dict()
# Do this here so the var get updated when a library changes
global pref_use_primary_find_in_search
pref_use_primary_find_in_search = prefs['use_primary_find_in_search']
def break_cycles(self): def break_cycles(self):
self._data = self.field_metadata = self.FIELD_MAP = \ self._data = self.field_metadata = self.FIELD_MAP = \
@ -617,9 +625,6 @@ class ResultCache(SearchQueryParser): # {{{
def get_matches(self, location, query, candidates=None, def get_matches(self, location, query, candidates=None,
allow_recursion=True): allow_recursion=True):
global pref_use_primary_find_in_search
pref_use_primary_find_in_search = prefs['use_primary_find_in_search']
matches = set([]) matches = set([])
if candidates is None: if candidates is None:
candidates = self.universal_set() candidates = self.universal_set()