mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix clicking on first letter of author names generating incorrect search. Also fix updating bulk metadata in custom column causing unnneccessary Tag Browser refreshes.
This commit is contained in:
commit
4b089eae1d
@ -1493,6 +1493,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
self.tags_view.tag_item_renamed.emit()
|
self.tags_view.tag_item_renamed.emit()
|
||||||
item.tag.name = val
|
item.tag.name = val
|
||||||
self.rename_item_in_all_user_categories(name, key, val)
|
self.rename_item_in_all_user_categories(name, key, val)
|
||||||
|
self.tags_view.refresh_required.emit()
|
||||||
self.show_item_at_path(path)
|
self.show_item_at_path(path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -1686,10 +1687,19 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if self.collapse_model == 'first letter' and \
|
if self.collapse_model == 'first letter' and \
|
||||||
tag_item.temporary and not key.startswith('@') \
|
tag_item.temporary and not key.startswith('@') \
|
||||||
and tag_item.tag.state:
|
and tag_item.tag.state:
|
||||||
if node_searches[tag_item.tag.state] == 'true':
|
k = 'author_sort' if key == 'authors' else key
|
||||||
ans.append('%s:~^%s'%(key, tag_item.py_name))
|
letters_seen = {}
|
||||||
|
for subnode in tag_item.children:
|
||||||
|
letters_seen[subnode.tag.sort[0]] = True
|
||||||
|
charclass = ''.join(letters_seen)
|
||||||
|
if k == 'author_sort':
|
||||||
|
expr = r'%s:"~(^[%s])|(&\\s*[%s])"'%(k, charclass, charclass)
|
||||||
else:
|
else:
|
||||||
ans.append('(not %s:~^%s )'%(key, tag_item.py_name))
|
expr = r'%s:"~^[%s]"'%(k, charclass)
|
||||||
|
if node_searches[tag_item.tag.state] == 'true':
|
||||||
|
ans.append(expr)
|
||||||
|
else:
|
||||||
|
ans.append('(not ' + expr + ')')
|
||||||
continue
|
continue
|
||||||
tag = tag_item.tag
|
tag = tag_item.tag
|
||||||
if tag.state != TAG_SEARCH_STATES['clear']:
|
if tag.state != TAG_SEARCH_STATES['clear']:
|
||||||
@ -1821,6 +1831,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if idx.isValid():
|
if idx.isValid():
|
||||||
self.tags_view.setCurrentIndex(idx)
|
self.tags_view.setCurrentIndex(idx)
|
||||||
self.tags_view.scrollTo(idx, position)
|
self.tags_view.scrollTo(idx, position)
|
||||||
|
self.tags_view.setCurrentIndex(idx)
|
||||||
if box:
|
if box:
|
||||||
tag_item = idx.internalPointer()
|
tag_item = idx.internalPointer()
|
||||||
tag_item.boxed = True
|
tag_item.boxed = True
|
||||||
|
@ -2012,7 +2012,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
val = mi.get(key, None)
|
val = mi.get(key, None)
|
||||||
if force_changes or val is not None:
|
if force_changes or val is not None:
|
||||||
doit(self.set_custom, id, val=val, extra=mi.get_extra(key),
|
doit(self.set_custom, id, val=val, extra=mi.get_extra(key),
|
||||||
label=user_mi[key]['label'], commit=False)
|
label=user_mi[key]['label'], commit=False, notify=False)
|
||||||
if commit:
|
if commit:
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
if notify:
|
if notify:
|
||||||
|
@ -785,7 +785,7 @@ class BuiltinDaysBetween(BuiltinFormatterFunction):
|
|||||||
except:
|
except:
|
||||||
return ''
|
return ''
|
||||||
i = d1 - d2
|
i = d1 - d2
|
||||||
return str(i.days)
|
return str('%d.%d'%(i.days, i.seconds/8640))
|
||||||
|
|
||||||
|
|
||||||
builtin_add = BuiltinAdd()
|
builtin_add = BuiltinAdd()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user