library: refresh scraped cover in grid even when items were rebuilt
refresh_item matched the grid row by object identity, which silently fails when the library list was rebuilt (background scan/store refresh) while the scrape dialog was open. Match by release_id + system as a fallback, like update_item_label already does, so the cover tile updates without a Reload.
This commit is contained in:
+9
-1
@@ -494,9 +494,17 @@ class CoverShowcase(QWidget):
|
||||
pm = QPixmap(str(path))
|
||||
if pm.isNull():
|
||||
return
|
||||
# Match by identity when possible, falling back to release_id/system
|
||||
# equality (the library may have been rebuilt while the scrape dialog
|
||||
# was open, replacing the item objects).
|
||||
for i in range(self.list.count()):
|
||||
item = self.list.item(i)
|
||||
if item.data(Qt.UserRole) is it:
|
||||
data = item.data(Qt.UserRole)
|
||||
if data is it or (
|
||||
data is not None
|
||||
and data.get("release_id") == it.get("release_id")
|
||||
and (data.get("system") or "games") == system
|
||||
):
|
||||
item.setIcon(self._fit_icon(pm))
|
||||
if i in self.missing:
|
||||
self.missing.remove(i)
|
||||
|
||||
Reference in New Issue
Block a user