diff --git a/bagheeraview.py b/bagheeraview.py index a9605c2..ca47b8f 100755 --- a/bagheeraview.py +++ b/bagheeraview.py @@ -14,7 +14,7 @@ Classes: MainWindow: The main application window containing the thumbnail grid and docks. """ __appname__ = "BagheeraView" -__version__ = "0.9.20" +__version__ = "0.9.21" __author__ = "Ignacio Serantes" __email__ = "kde@aynoa.net" __license__ = "LGPL" diff --git a/constants.py b/constants.py index daa037c..6c0df4d 100644 --- a/constants.py +++ b/constants.py @@ -29,7 +29,7 @@ if FORCE_X11: # --- CONFIGURATION --- PROG_NAME = "Bagheera Image Viewer" PROG_ID = "bagheeraview" -PROG_VERSION = "0.9.20" +PROG_VERSION = "0.9.21" PROG_AUTHOR = "Ignacio Serantes" # --- CACHE SETTINGS --- @@ -137,6 +137,11 @@ SCANNER_SETTINGS_DEFAULTS = { "person_tags": "", "generation_threads": 4, "search_engine": "", + "face_use_last_name": False, + "pet_use_last_name": False, + "body_use_last_name": False, + "object_use_last_name": False, + "landmark_use_last_name": False, "duplicate_threshold": 90, # Similarity percentage (50-100) "duplicate_method": "histogram_hashing", "duplicate_confirm_delete": True, @@ -634,6 +639,9 @@ _UI_TEXTS = { "landmark names to remember.", "SETTINGS_PATH_NOT_FOUND_WARNING": "Warning: Path not found or is not " "a directory: {}", + "SETTINGS_USE_LAST_NAME_LABEL": "Use last name by default", + "SETTINGS_USE_LAST_NAME_TOOLTIP": "Automatically fill the assignment window " + "with the last used name.", "SETTINGS_FACE_HISTORY_COUNT_LABEL": "Max face history:", "SETTINGS_THUMBS_REFRESH_LABEL": "Thumbs refresh interval (ms):", "MENU_VIEWER_SETTINGS": "Viewer Settings", @@ -1181,6 +1189,9 @@ _UI_TEXTS = { "usados recientemente para recordar.", "SETTINGS_PATH_NOT_FOUND_WARNING": "Advertencia: La ruta no existe o " "no es un directorio: {}", + "SETTINGS_USE_LAST_NAME_LABEL": "Usar último nombre por defecto", + "SETTINGS_USE_LAST_NAME_TOOLTIP": "Rellena automáticamente la ventana de " + "asignación con el último nombre utilizado.", "SETTINGS_FACE_HISTORY_COUNT_LABEL": "Máximo historial de caras:", "SETTINGS_THUMBS_REFRESH_LABEL": "Intervalo refresco miniaturas (ms):", "SETTINGS_THUMBS_BG_COLOR_LABEL": "Color de fondo de miniaturas:", @@ -1730,6 +1741,9 @@ _UI_TEXTS = { "usados recentemente para lembrar.", "SETTINGS_PATH_NOT_FOUND_WARNING": "Advertencia: A ruta non existe ou " "non é un directorio: {}", + "SETTINGS_USE_LAST_NAME_LABEL": "Usar o último nome por defecto", + "SETTINGS_USE_LAST_NAME_TOOLTIP": "Rechea automáticamente a ventá de " + "asignación có último nome utilizado.", "SETTINGS_FACE_HISTORY_COUNT_LABEL": "Máximo historial de caras:", "SETTINGS_THUMBS_REFRESH_LABEL": "Intervalo refresco miniaturas (ms):", "SETTINGS_THUMBS_BG_COLOR_LABEL": "Cor de fondo de miniaturas:", diff --git a/imageviewer.py b/imageviewer.py index ed3fbd2..808ae57 100644 --- a/imageviewer.py +++ b/imageviewer.py @@ -1013,8 +1013,12 @@ class FaceCanvas(QLabel): history = history_list \ if self.viewer.main_win else [] + setting_key = f"{region_type.lower()}_use_last_name" + suggested = history[0] if history and APP_CONFIG.get( + setting_key, False) else "" + full_tag, updated_history, ok = FaceNameDialog.get_name( - self.viewer, history, + self.viewer, history, current_name=suggested, main_win=self.viewer.main_win, region_type=region_type) if ok and full_tag: @@ -3114,8 +3118,10 @@ class ImageViewer(QWidget): QApplication.processEvents() history = self.main_win.face_names_history if self.main_win else [] + suggested = history[0] if history and APP_CONFIG.get( + "face_use_last_name", False) else "" full_tag, updated_history, ok = FaceNameDialog.get_name( - self, history, main_win=self.main_win) + self, history, current_name=suggested, main_win=self.main_win) if ok and full_tag: new_face['name'] = full_tag @@ -3171,8 +3177,10 @@ class ImageViewer(QWidget): QApplication.processEvents() history = self.main_win.pet_names_history if self.main_win else [] + suggested = history[0] if history and APP_CONFIG.get( + "pet_use_last_name", False) else "" full_tag, updated_history, ok = FaceNameDialog.get_name( - self, history, main_win=self.main_win, region_type="Pet") + self, history, current_name=suggested, main_win=self.main_win, region_type="Pet") if ok and full_tag: new_pet['name'] = full_tag @@ -3229,8 +3237,10 @@ class ImageViewer(QWidget): # For bodies, we typically don't ask for a name immediately unless desired # Or we can treat it like pets/faces and ask. Let's ask. history = self.main_win.body_names_history if self.main_win else [] + suggested = history[0] if history and APP_CONFIG.get( + "body_use_last_name", False) else "" full_tag, updated_history, ok = FaceNameDialog.get_name( - self, history, main_win=self.main_win, region_type="Body") + self, history, current_name=suggested, main_win=self.main_win, region_type="Body") if ok and full_tag: new_body['name'] = full_tag @@ -3317,7 +3327,7 @@ class ImageViewer(QWidget): # A standard tick is 120. We define a threshold based on speed. # Speed 1 (slowest) requires a full 120 delta. # Speed 10 (fastest) requires 120/10 = 12 delta. - # Still too fast so speed / 2. + # Still too fast so speed / 2. threshold = 120 / speed / 2 self._wheel_scroll_accumulator += event.angleDelta().y() diff --git a/pyproject.toml b/pyproject.toml index 391b200..7872258 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "bagheeraview" -version = "0.9.20" +version = "0.9.21" authors = [ { name = "Ignacio Serantes" } ] diff --git a/settings.py b/settings.py index d8d9af3..ffab8e3 100644 --- a/settings.py +++ b/settings.py @@ -614,6 +614,10 @@ class SettingsDialog(QDialog): self.face_history_spin.setToolTip(UITexts.SETTINGS_FACE_HISTORY_TOOLTIP) faces_layout.addLayout(face_history_layout) + self.face_use_last_name_check = QCheckBox(UITexts.SETTINGS_USE_LAST_NAME_LABEL) + self.face_use_last_name_check.setToolTip(UITexts.SETTINGS_USE_LAST_NAME_TOOLTIP) + faces_layout.addWidget(self.face_use_last_name_check) + # --- Pets Section --- faces_layout.addSpacing(10) pets_header = QLabel(UITexts.TYPE_PET) @@ -670,6 +674,10 @@ class SettingsDialog(QDialog): self.pet_history_spin.setToolTip(UITexts.SETTINGS_PET_HISTORY_TOOLTIP) faces_layout.addLayout(pet_history_layout) + self.pet_use_last_name_check = QCheckBox(UITexts.SETTINGS_USE_LAST_NAME_LABEL) + self.pet_use_last_name_check.setToolTip(UITexts.SETTINGS_USE_LAST_NAME_TOOLTIP) + faces_layout.addWidget(self.pet_use_last_name_check) + # --- Body Section --- faces_layout.addSpacing(10) body_header = QLabel(UITexts.TYPE_BODY) @@ -717,6 +725,10 @@ class SettingsDialog(QDialog): self.body_history_spin.setToolTip(UITexts.SETTINGS_BODY_HISTORY_TOOLTIP) faces_layout.addLayout(body_history_layout) + self.body_use_last_name_check = QCheckBox(UITexts.SETTINGS_USE_LAST_NAME_LABEL) + self.body_use_last_name_check.setToolTip(UITexts.SETTINGS_USE_LAST_NAME_TOOLTIP) + faces_layout.addWidget(self.body_use_last_name_check) + # --- Object Section --- faces_layout.addSpacing(10) object_header = QLabel(UITexts.TYPE_OBJECT) @@ -763,6 +775,10 @@ class SettingsDialog(QDialog): self.object_history_spin.setToolTip(UITexts.SETTINGS_OBJECT_HISTORY_TOOLTIP) faces_layout.addLayout(object_history_layout) + self.object_use_last_name_check = QCheckBox(UITexts.SETTINGS_USE_LAST_NAME_LABEL) + self.object_use_last_name_check.setToolTip(UITexts.SETTINGS_USE_LAST_NAME_TOOLTIP) + faces_layout.addWidget(self.object_use_last_name_check) + # --- Landmark Section --- faces_layout.addSpacing(10) landmark_header = QLabel(UITexts.TYPE_LANDMARK) @@ -810,6 +826,10 @@ class SettingsDialog(QDialog): faces_layout.addLayout(landmark_history_layout) faces_layout.addStretch() + self.landmark_use_last_name_check = QCheckBox(UITexts.SETTINGS_USE_LAST_NAME_LABEL) + self.landmark_use_last_name_check.setToolTip(UITexts.SETTINGS_USE_LAST_NAME_TOOLTIP) + faces_layout.addWidget(self.landmark_use_last_name_check) + # --- Viewer Tab --- viewer_wheel_layout = QHBoxLayout() viewer_wheel_label = QLabel(UITexts.SETTINGS_VIEWER_WHEEL_SPEED_LABEL) @@ -911,6 +931,12 @@ class SettingsDialog(QDialog): landmark_history_count = APP_CONFIG.get( "landmark_menu_max_items", FACES_MENU_MAX_ITEMS_DEFAULT) + face_use_last_name = APP_CONFIG.get("face_use_last_name", False) + pet_use_last_name = APP_CONFIG.get("pet_use_last_name", False) + body_use_last_name = APP_CONFIG.get("body_use_last_name", False) + object_use_last_name = APP_CONFIG.get("object_use_last_name", False) + landmark_use_last_name = APP_CONFIG.get("landmark_use_last_name", False) + thumbs_refresh_interval = APP_CONFIG.get( "thumbnails_refresh_interval", THUMBNAILS_REFRESH_INTERVAL_DEFAULT) thumbs_bg_color = APP_CONFIG.get( @@ -1026,6 +1052,12 @@ class SettingsDialog(QDialog): self.object_history_spin.setValue(object_history_count) self.landmark_history_spin.setValue(landmark_history_count) + self.face_use_last_name_check.setChecked(face_use_last_name) + self.pet_use_last_name_check.setChecked(pet_use_last_name) + self.body_use_last_name_check.setChecked(body_use_last_name) + self.object_use_last_name_check.setChecked(object_use_last_name) + self.landmark_use_last_name_check.setChecked(landmark_use_last_name) + self.thumbs_refresh_spin.setValue(thumbs_refresh_interval) self.set_thumbs_bg_button_color(thumbs_bg_color) self.set_thumbs_filename_button_color(thumbs_filename_color) @@ -1282,6 +1314,13 @@ class SettingsDialog(QDialog): APP_CONFIG["landmark_menu_max_items"] = self.landmark_history_spin.value() APP_CONFIG["thumbnails_refresh_interval"] = self.thumbs_refresh_spin.value() + APP_CONFIG["face_use_last_name"] = self.face_use_last_name_check.isChecked() + APP_CONFIG["pet_use_last_name"] = self.pet_use_last_name_check.isChecked() + APP_CONFIG["body_use_last_name"] = self.body_use_last_name_check.isChecked() + APP_CONFIG["object_use_last_name"] = self.object_use_last_name_check.isChecked() + APP_CONFIG["landmark_use_last_name"] = \ + self.landmark_use_last_name_check.isChecked() + APP_CONFIG["thumbnails_bg_color"] = self.current_thumbs_bg_color APP_CONFIG["thumbnails_filename_color"] = self.current_thumbs_filename_color APP_CONFIG["thumbnails_tags_color"] = self.current_thumbs_tags_color diff --git a/setup.py b/setup.py index 8059e7d..fa1818a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="bagheeraview", - version="0.9.20", + version="0.9.21", author="Ignacio Serantes", description="Bagheera Image Viewer - An image viewer for KDE with Baloo in mind", long_description="A fast image viewer built with PySide6, featuring search and "