mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
...
This commit is contained in:
commit
d1f1e5bb6d
@ -13,6 +13,7 @@ from calibre.gui2.preferences.search_ui import Ui_Form
|
||||
from calibre.gui2 import config, error_dialog
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.library.caches import set_use_primary_find_in_search
|
||||
|
||||
class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
|
||||
@ -223,6 +224,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
return ConfigWidgetBase.commit(self)
|
||||
|
||||
def refresh_gui(self, gui):
|
||||
set_use_primary_find_in_search(prefs['use_primary_find_in_search'])
|
||||
gui.set_highlight_only_button_icon()
|
||||
if self.muc_changed:
|
||||
gui.tags_view.recount()
|
||||
|
@ -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
|
||||
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
|
||||
EQUALS_MATCH = 1
|
||||
REGEXP_MATCH = 2
|
||||
@ -252,6 +257,9 @@ class ResultCache(SearchQueryParser): # {{{
|
||||
SearchQueryParser.__init__(self, self.all_search_locations, optimize=True)
|
||||
self.build_date_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):
|
||||
self._data = self.field_metadata = self.FIELD_MAP = \
|
||||
@ -617,9 +625,6 @@ class ResultCache(SearchQueryParser): # {{{
|
||||
|
||||
def get_matches(self, location, query, candidates=None,
|
||||
allow_recursion=True):
|
||||
global pref_use_primary_find_in_search
|
||||
pref_use_primary_find_in_search = prefs['use_primary_find_in_search']
|
||||
|
||||
matches = set([])
|
||||
if candidates is None:
|
||||
candidates = self.universal_set()
|
||||
|
Loading…
x
Reference in New Issue
Block a user