mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
d2983fef22
@ -453,23 +453,23 @@ class SearchRestrictionMixin:
|
||||
db.data.set_base_restriction_name('')
|
||||
elif library == '*':
|
||||
if not self.search.current_text:
|
||||
error_dialog(self, _('No search'),
|
||||
_('There is no current search to use'), show=True)
|
||||
return
|
||||
# Clear the temporary VL if the search box is empty
|
||||
db.data.set_base_restriction('')
|
||||
db.data.set_base_restriction_name('')
|
||||
else:
|
||||
txt = _build_full_search_string(self)
|
||||
try:
|
||||
db.data.search_getting_ids('', txt, use_virtual_library=False)
|
||||
except ParseException as e:
|
||||
error_dialog(self, _('Invalid search'),
|
||||
_('The search in the search box is not valid'),
|
||||
det_msg=e.msg, show=True)
|
||||
return
|
||||
|
||||
txt = _build_full_search_string(self)
|
||||
try:
|
||||
db.data.search_getting_ids('', txt, use_virtual_library=False)
|
||||
except ParseException as e:
|
||||
error_dialog(self, _('Invalid search'),
|
||||
_('The search in the search box is not valid'),
|
||||
det_msg=e.msg, show=True)
|
||||
return
|
||||
|
||||
self.search_based_vl = txt
|
||||
db.data.set_base_restriction(txt)
|
||||
self.search_based_vl_name = self._trim_restriction_name('*' + txt)
|
||||
db.data.set_base_restriction_name(self.search_based_vl_name)
|
||||
self.search_based_vl = txt
|
||||
db.data.set_base_restriction(txt)
|
||||
self.search_based_vl_name = self._trim_restriction_name('*' + txt)
|
||||
db.data.set_base_restriction_name(self.search_based_vl_name)
|
||||
elif library == self.search_based_vl_name:
|
||||
db.data.set_base_restriction(self.search_based_vl)
|
||||
db.data.set_base_restriction_name(self.search_based_vl_name)
|
||||
|
@ -1717,15 +1717,18 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
letters_seen = {}
|
||||
for subnode in tag_item.children:
|
||||
if subnode.tag.sort:
|
||||
letters_seen[subnode.tag.sort[0]] = True
|
||||
c = subnode.tag.sort[0]
|
||||
if c in r'\.^$[]|()':
|
||||
c = f'\\{c}'
|
||||
letters_seen[c] = True
|
||||
if letters_seen:
|
||||
charclass = ''.join(letters_seen)
|
||||
if k == 'author_sort':
|
||||
expr = r'%s:"~(^[%s])|(&\s*[%s])"'%(k, charclass, charclass)
|
||||
expr = r'%s:"""~(^[%s])|(&\s*[%s])"""'%(k, charclass, charclass)
|
||||
elif k == 'series':
|
||||
expr = r'series_sort:"~^[%s]"'%(charclass)
|
||||
expr = r'series_sort:"""~^[%s]"""'%(charclass)
|
||||
else:
|
||||
expr = r'%s:"~^[%s]"'%(k, charclass)
|
||||
expr = r'%s:"""~^[%s]"""'%(k, charclass)
|
||||
else:
|
||||
expr = r'%s:false'%(k)
|
||||
if node_searches[tag_item.tag.state] == 'true':
|
||||
|
Loading…
x
Reference in New Issue
Block a user