mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Small search API change to let someone add, then set, a search restriction
This commit is contained in:
parent
878986d6b5
commit
a83b144ea7
@ -436,17 +436,18 @@ class SavedSearchBoxMixin(object): # {{{
|
|||||||
b = getattr(self, x+'_search_button')
|
b = getattr(self, x+'_search_button')
|
||||||
b.setStatusTip(b.toolTip())
|
b.setStatusTip(b.toolTip())
|
||||||
|
|
||||||
def saved_searches_changed(self):
|
def saved_searches_changed(self, set_restriction=None):
|
||||||
p = sorted(saved_searches().names(), key=sort_key)
|
p = sorted(saved_searches().names(), key=sort_key)
|
||||||
t = unicode(self.search_restriction.currentText())
|
if set_restriction is None:
|
||||||
|
set_restriction = unicode(self.search_restriction.currentText())
|
||||||
# rebuild the restrictions combobox using current saved searches
|
# rebuild the restrictions combobox using current saved searches
|
||||||
self.search_restriction.clear()
|
self.search_restriction.clear()
|
||||||
self.search_restriction.addItem('')
|
self.search_restriction.addItem('')
|
||||||
self.tags_view.recount()
|
self.tags_view.recount()
|
||||||
for s in p:
|
for s in p:
|
||||||
self.search_restriction.addItem(s)
|
self.search_restriction.addItem(s)
|
||||||
if t: # redo the search restriction if there was one
|
if set_restriction: # redo the search restriction if there was one
|
||||||
self.apply_named_search_restriction(t)
|
self.apply_named_search_restriction(set_restriction)
|
||||||
|
|
||||||
def do_saved_search_edit(self, search):
|
def do_saved_search_edit(self, search):
|
||||||
d = SavedSearchEditor(self, search)
|
d = SavedSearchEditor(self, search)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user