This commit is contained in:
Ignacio Serantes
2026-04-07 16:22:59 +02:00
parent 9685c01760
commit bff99226b0
7 changed files with 42 additions and 37 deletions

View File

@@ -23,10 +23,10 @@ class DuplicateManagerDialog(QDialog):
self.main_win = main_win
self.review_mode = review_mode
self.active_pane = None
self.active_pane = None # Track the focused pane
self.current_dup_pair = None # Stores the current DuplicateResult object
self.panes_linked = True # Default to linked
self._user_link_preference = True # Persiste la intención del usuario
self._user_link_preference = True # Persists user intent
self._is_syncing = False # Guard to prevent recursion during synchronization
self.setWindowTitle(UITexts.DUPLICATE_MANAGER_TITLE)
@@ -194,7 +194,7 @@ class DuplicateManagerDialog(QDialog):
def wheelEvent(self, event):
"""Handles mouse wheel events for zooming (with Ctrl)."""
if event.modifiers() & Qt.ControlModifier and self.active_pane:
# Calcular el punto de enfoque relativo al pane activo
# Calculate the focus point relative to the active pane.
focus_pos = self.active_pane.mapFromGlobal(event.globalPosition().toPoint())
if event.angleDelta().y() > 0:
self.active_pane.zoom_manager.zoom(1.1, focus_point=focus_pos)
@@ -364,8 +364,7 @@ class DuplicateManagerDialog(QDialog):
else:
col_offset = 0
# Columna similarity (usamos DisplayRole con int para que ordene
# numéricamente)
# Similarity column (using DisplayRole with int for numerical sorting).
sim_item = QTableWidgetItem()
sim_item.setData(Qt.DisplayRole, dup.similarity
if dup.similarity is not None else 0)
@@ -373,7 +372,7 @@ class DuplicateManagerDialog(QDialog):
if not self.review_mode:
sim_item.setData(Qt.UserRole, i)
# Columna 1: Nombres de ficheros
# Column 1: File names
names_item = QTableWidgetItem(f"{name1}{name2}")
self.table_widget.setItem(row, col_offset, sim_item)
@@ -392,8 +391,8 @@ class DuplicateManagerDialog(QDialog):
if row < 0 or row >= self.table_widget.rowCount():
return
# Obtenemos el índice real de la lista duplicates guardado en el UserRole del
# item
# Get the real index of the duplicates list stored in the UserRole of
# the item.
item = self.table_widget.item(row, 0)
if not item:
return
@@ -407,7 +406,7 @@ class DuplicateManagerDialog(QDialog):
if dup.similarity == 100:
similarity_color = "#2ecc71" # Green
elif dup.similarity < 80:
similarity_color = "#e74c3c" # Red
similarity_color = "#e74c3c" # Red
self.similarity_lbl.setText(f"{dup.similarity}% Similarity")
self.similarity_lbl.setStyleSheet(
@@ -524,11 +523,11 @@ class DuplicateManagerDialog(QDialog):
dir_lbl.setText("N/A")
return True
# Metadatos
# Metadata
size_bytes = os.path.getsize(path)
size_str = self._format_size(size_bytes)
# Detección de imágenes animadas o resoluciones inválidas
# Detection of animated images or invalid resolutions
reader = QImageReader(path)
is_animated = reader.supportsAnimation() and reader.imageCount() > 1
is_invalid = (pane.controller.pixmap_original.isNull() or
@@ -755,7 +754,7 @@ class DuplicateManagerDialog(QDialog):
if d.path1 == old_path or d.path2 == old_path:
p1 = new_path if d.path1 == old_path else d.path1
p2 = new_path if d.path2 == old_path else d.path2
# Actualizamos la tupla con nombre usando _replace
# Update the named tuple using _replace
self.duplicates[i] = d._replace(path1=p1, path2=p2)
updated = True
@@ -781,10 +780,10 @@ class DuplicateManagerDialog(QDialog):
if self.review_mode and self.current_dup_pair:
self.cache.mark_as_exception(
self.current_dup_pair.path1, self.current_dup_pair.path2, False)
# Borramos los hashes para que el detector las trate como imágenes nuevas
# y fuerce una nueva comparación en el siguiente escaneo.
# Usamos clear_relationships=False para no perder otras posibles
# coincidencias ya marcadas.
# Clear hashes so the detector treats them as new images and
# forces a new comparison in the next scan. We use
# clear_relationships=False to preserve other possible matches
# already identified.
self.cache.remove_hash_for_path(
self.current_dup_pair.path1, clear_relationships=False)
self.cache.remove_hash_for_path(