mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Speedup completion for authors and tags for libraries on slow storage
This commit is contained in:
parent
da120c620d
commit
3bca088525
@ -125,7 +125,7 @@ class BooksView(QTableView): # {{{
|
||||
self.last_modified_delegate = DateDelegate(self,
|
||||
tweak_name='gui_last_modified_display_format')
|
||||
self.languages_delegate = LanguagesDelegate(self)
|
||||
self.tags_delegate = CompleteDelegate(self, ',', 'all_tags')
|
||||
self.tags_delegate = CompleteDelegate(self, ',', 'all_tag_names')
|
||||
self.authors_delegate = CompleteDelegate(self, '&', 'all_author_names', True)
|
||||
self.cc_names_delegate = CompleteDelegate(self, '&', 'all_custom', True)
|
||||
self.series_delegate = TextDelegate(self)
|
||||
|
@ -1114,7 +1114,7 @@ class TagsEdit(MultiCompleteLineEdit): # {{{
|
||||
tags = db.tags(id_, index_is_id=True)
|
||||
tags = tags.split(',') if tags else []
|
||||
self.current_val = tags
|
||||
self.all_items = db.all_tags()
|
||||
self.all_items = db.all_tag_names()
|
||||
self.original_val = self.current_val
|
||||
|
||||
@property
|
||||
|
@ -3737,4 +3737,42 @@ books_series_link feeds
|
||||
'SELECT {0}, count(*) FROM books_{1}_link GROUP BY {0}'.format(
|
||||
fm['link_column'], fm['table']))
|
||||
|
||||
def all_author_names(self):
|
||||
ai = self.FIELD_MAP['authors']
|
||||
ans = set()
|
||||
for rec in self.data.iterall():
|
||||
auts = rec[ai]
|
||||
if auts:
|
||||
for x in auts.split(','):
|
||||
ans.add(x.replace('|', ','))
|
||||
return ans
|
||||
|
||||
def all_tag_names(self):
|
||||
ai = self.FIELD_MAP['tags']
|
||||
ans = set()
|
||||
for rec in self.data.iterall():
|
||||
auts = rec[ai]
|
||||
if auts:
|
||||
for x in auts.split(','):
|
||||
ans.add(x)
|
||||
return ans
|
||||
|
||||
def all_publisher_names(self):
|
||||
ai = self.FIELD_MAP['publisher']
|
||||
ans = set()
|
||||
for rec in self.data.iterall():
|
||||
auts = rec[ai]
|
||||
if auts:
|
||||
ans.add(auts)
|
||||
return ans
|
||||
|
||||
def all_series_names(self):
|
||||
ai = self.FIELD_MAP['series']
|
||||
ans = set()
|
||||
for rec in self.data.iterall():
|
||||
auts = rec[ai]
|
||||
if auts:
|
||||
ans.add(auts)
|
||||
return ans
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user