mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Register cover caches with the db
This commit is contained in:
parent
0b9fe18d91
commit
f3bb9ea4ed
@ -80,6 +80,9 @@ class CoverCache(dict):
|
|||||||
with self.lock:
|
with self.lock:
|
||||||
self.items.clear()
|
self.items.clear()
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return id(self)
|
||||||
|
|
||||||
class CoverDelegate(QStyledItemDelegate):
|
class CoverDelegate(QStyledItemDelegate):
|
||||||
|
|
||||||
def __init__(self, parent, width, height):
|
def __init__(self, parent, width, height):
|
||||||
@ -212,6 +215,11 @@ class GridView(QListView):
|
|||||||
def set_database(self, newdb, stage=0):
|
def set_database(self, newdb, stage=0):
|
||||||
if stage == 0:
|
if stage == 0:
|
||||||
self.ignore_render_requests.set()
|
self.ignore_render_requests.set()
|
||||||
|
try:
|
||||||
|
self.model().db.new_api.remove_cover_cache(self.delegate.cover_cache)
|
||||||
|
except AttributeError:
|
||||||
|
pass # db is None
|
||||||
|
newdb.new_api.add_cover_cache(self.delegate.cover_cache)
|
||||||
try:
|
try:
|
||||||
# Use a timeout so that if, for some reason, the render thread
|
# Use a timeout so that if, for some reason, the render thread
|
||||||
# gets stuck, we dont deadlock, future covers wont get
|
# gets stuck, we dont deadlock, future covers wont get
|
||||||
|
Loading…
x
Reference in New Issue
Block a user