Fixed hang with gifs in duplicates form
This commit is contained in:
@@ -1037,7 +1037,7 @@ class MainWindow(QMainWindow):
|
||||
self._group_info_cache = {}
|
||||
self._visible_paths_cache = None # Cache for visible image paths
|
||||
self._path_to_model_index = {}
|
||||
self._paths_being_modified_by_app = set() # For ignoring FS events
|
||||
self._paths_being_modified_by_app = set() # For ignoring FS events
|
||||
|
||||
# Keep references to open viewers to manage their lifecycle
|
||||
self.viewers = []
|
||||
@@ -1844,7 +1844,8 @@ class MainWindow(QMainWindow):
|
||||
self, UITexts.DUPLICATE_DETECTION_TITLE, UITexts.DUPLICATE_NONE_FOUND)
|
||||
return
|
||||
|
||||
# Por defecto usamos el modo optimizado (incremental) para no repetir comparaciones
|
||||
# Por defecto usamos el modo optimizado (incremental) para no repetir
|
||||
# comparaciones
|
||||
self.start_duplicate_detection(force_full=False, custom_paths=paths)
|
||||
|
||||
def _gather_files_for_duplicates(self):
|
||||
@@ -4879,24 +4880,28 @@ class MainWindow(QMainWindow):
|
||||
new_size = new_stat.st_size
|
||||
|
||||
# Find old data from internal list
|
||||
old_item_data = next((item for item in self.found_items_data if item[0] == path), None)
|
||||
old_item_data = next((item for item in self.found_items_data
|
||||
if item[0] == path), None)
|
||||
old_mtime = old_item_data[2] if old_item_data else 0
|
||||
old_size = os.path.getsize(path) if old_item_data else 0 # Re-read size from disk for comparison
|
||||
# Re-read size from disk for comparison
|
||||
old_size = os.path.getsize(path) if old_item_data else 0
|
||||
|
||||
if new_size == old_size and new_mtime != old_mtime:
|
||||
# Likely metadata-only change (size unchanged, mtime changed)
|
||||
res = load_common_metadata(path)
|
||||
self._update_internal_data(path, mtime=new_mtime, tags=res.tags, rating=res.rating,
|
||||
inode=new_stat.st_ino, dev=new_stat.st_dev)
|
||||
self._update_internal_data(
|
||||
path, mtime=new_mtime, tags=res.tags, rating=res.rating,
|
||||
inode=new_stat.st_ino, dev=new_stat.st_dev)
|
||||
self.proxy_model.add_to_cache(path, res.tags)
|
||||
self.thumbnail_view.viewport().update() # Force repaint
|
||||
self.thumbnail_view.viewport().update() # Force repaint
|
||||
self.status_lbl.setText(f"Metadata updated: {os.path.basename(path)}")
|
||||
else:
|
||||
# Content or size changed, invalidate thumbnail and rebuild view
|
||||
self.cache.invalidate_path(path)
|
||||
res = load_common_metadata(path) # Re-read metadata as well
|
||||
self._update_internal_data(path, mtime=new_mtime, tags=res.tags, rating=res.rating,
|
||||
inode=new_stat.st_ino, dev=new_stat.st_dev)
|
||||
res = load_common_metadata(path) # Re-read metadata as well
|
||||
self._update_internal_data(
|
||||
path, mtime=new_mtime, tags=res.tags, rating=res.rating,
|
||||
inode=new_stat.st_ino, dev=new_stat.st_dev)
|
||||
self.proxy_model.add_to_cache(path, res.tags)
|
||||
self.rebuild_view()
|
||||
self.status_lbl.setText(f"File modified: {os.path.basename(path)}")
|
||||
@@ -4912,8 +4917,10 @@ class MainWindow(QMainWindow):
|
||||
self._paths_being_modified_by_app.add(parent_path)
|
||||
|
||||
# Schedule removal after a delay to allow all FS events to propagate
|
||||
QTimer.singleShot(1000, lambda: self._paths_being_modified_by_app.discard(abs_path))
|
||||
QTimer.singleShot(1000, lambda: self._paths_being_modified_by_app.discard(parent_path))
|
||||
QTimer.singleShot(
|
||||
1000, lambda: self._paths_being_modified_by_app.discard(abs_path))
|
||||
QTimer.singleShot(
|
||||
1000, lambda: self._paths_being_modified_by_app.discard(parent_path))
|
||||
|
||||
def on_fs_watcher_status_changed(self, is_monitoring):
|
||||
"""Updates the UI indicator for the FileSystemWatcher."""
|
||||
|
||||
Reference in New Issue
Block a user