This commit is contained in:
Ignacio Serantes
2026-03-26 09:01:41 +01:00
parent dfddfd17b3
commit a7ce2ceb75
10 changed files with 178 additions and 113 deletions

View File

@@ -112,8 +112,8 @@ class ImagePreloader(QThread):
img = reader.read()
if not img.isNull():
# Load tags and rating here to avoid re-reading in main thread
tags, rating = load_common_metadata(path)
self.image_ready.emit(idx, path, img, tags, rating)
res = load_common_metadata(path)
self.image_ready.emit(idx, path, img, res.tags, res.rating)
except Exception as e:
logger.warning(f"ImagePreloader failed to load {path}: {e}")
@@ -220,7 +220,8 @@ class ImageController(QObject):
if path and self._loaded_path == path and not self.pixmap_original.isNull():
# Ensure metadata is consistent with current path
if self._current_metadata_path != path:
self._current_tags, self._current_rating = load_common_metadata(path)
res = load_common_metadata(path)
self._current_tags, self._current_rating = res.tags, res.rating
self._current_metadata_path = path
self._trigger_preload()
@@ -258,7 +259,8 @@ class ImageController(QObject):
# Load tags and rating if not already set for this path
if self._current_metadata_path != path:
self._current_tags, self._current_rating = load_common_metadata(path)
res = load_common_metadata(path)
self._current_tags, self._current_rating = res.tags, res.rating
self._current_metadata_path = path
self._loaded_path = path
@@ -778,7 +780,8 @@ class ImageController(QObject):
# Reload from disk if not provided to ensure consistency
path = self.get_current_path()
if path:
self._current_tags, self._current_rating = load_common_metadata(path)
res = load_common_metadata(path)
self._current_tags, self._current_rating = res.tags, res.rating
self._current_metadata_path = path
else:
self._current_tags = []
@@ -810,7 +813,8 @@ class ImageController(QObject):
# Reload metadata for the current image to avoid stale/empty state
path = self.get_current_path()
if path:
self._current_tags, self._current_rating = load_common_metadata(path)
res = load_common_metadata(path)
self._current_tags, self._current_rating = res.tags, res.rating
self._current_metadata_path = path
else:
self._current_tags = []