mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
bf43041b19
@ -386,11 +386,12 @@ class View:
|
||||
changed_ids = old_marked_ids | cmids
|
||||
self.cache.clear_search_caches(changed_ids)
|
||||
self.cache.clear_caches(book_ids=changed_ids)
|
||||
if old_marked_ids != cmids:
|
||||
for funcref in itervalues(self.marked_listeners):
|
||||
func = funcref()
|
||||
if func is not None:
|
||||
func(old_marked_ids, cmids)
|
||||
# Always call the listener because the labels might have changed even
|
||||
# if the ids haven't.
|
||||
for funcref in itervalues(self.marked_listeners):
|
||||
func = funcref()
|
||||
if func is not None:
|
||||
func(old_marked_ids, cmids)
|
||||
|
||||
def toggle_marked_ids(self, book_ids):
|
||||
book_ids = set(book_ids)
|
||||
@ -412,11 +413,16 @@ class View:
|
||||
|
||||
def refresh_ids(self, ids):
|
||||
self.cache.clear_caches(book_ids=ids)
|
||||
try:
|
||||
return list(map(self.id_to_index, ids))
|
||||
except ValueError:
|
||||
pass
|
||||
return None
|
||||
|
||||
# The ids list can contain invalid ids (deleted etc). We want to filter
|
||||
# those out while keeping the valid ones.
|
||||
def f(id_):
|
||||
try:
|
||||
return self.id_to_index(id_)
|
||||
except ValueError:
|
||||
return None
|
||||
res = [i for i in map(f, ids) if i is not None]
|
||||
return res if res else None
|
||||
|
||||
def remove(self, book_id):
|
||||
try:
|
||||
|
@ -964,16 +964,16 @@ class BooksView(QTableView): # {{{
|
||||
# This is needed otherwise Qt does not always update the
|
||||
# viewport correctly. See https://bugs.launchpad.net/bugs/1404697
|
||||
self.row_header.viewport().update()
|
||||
# refresh the rows because there might be a composite that uses marked_books()
|
||||
self.model().refresh_rows(changed)
|
||||
# refresh the rows because there might be a composite that uses marked_books()
|
||||
self.model().refresh_rows(sections)
|
||||
else:
|
||||
# Marked items have either appeared or all been removed
|
||||
self.model().set_row_decoration(current_marked)
|
||||
self.row_header.headerDataChanged(Qt.Orientation.Vertical, 0, self.row_header.count()-1)
|
||||
self.row_header.geometriesChanged.emit()
|
||||
self.set_row_header_visibility()
|
||||
# refresh the rows because there might be a composite that uses marked_books()
|
||||
self.model().refresh_rows(current_marked)
|
||||
# refresh rows for the ids because there might be a composite that uses marked_books()
|
||||
self.model().refresh_ids(current_marked)
|
||||
|
||||
def set_row_header_visibility(self):
|
||||
visible = self.model().row_decoration is not None or gprefs['row_numbers_in_book_list']
|
||||
|
Loading…
x
Reference in New Issue
Block a user