From 9d286112b686331e99e4889f5cd11153ae1e1e8c Mon Sep 17 00:00:00 2001 From: Ignacio Serantes Date: Tue, 14 Apr 2026 20:59:13 +0200 Subject: [PATCH] v0.9.22 --- bagheeraview.py | 17 ++++++++--------- constants.py | 8 ++++---- imageviewer.py | 35 +++++++++++++++++++---------------- pyproject.toml | 2 +- setup.py | 2 +- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/bagheeraview.py b/bagheeraview.py index ca47b8f..a6ab94a 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.21" +__version__ = "0.9.22" __author__ = "Ignacio Serantes" __email__ = "kde@aynoa.net" __license__ = "LGPL" @@ -4453,10 +4453,9 @@ class MainWindow(QMainWindow): self.proxy_model.data(selected_indexes[0], PATH_ROLE)) self.populate_open_with_submenu(open_submenu, full_path) - # New action: Open in Fullscreen Viewer - action_open_fullscreen = open_submenu.addAction( + action_open_fullscreen = menu.addAction( QIcon.fromTheme("view-fullscreen"), - UITexts.CONTEXT_MENU_OPEN_FULLSCREEN_VIEWER) + UITexts.CONTEXT_MENU_FULLSCREEN_VIEWER) action_open_fullscreen.triggered.connect( lambda: self.open_in_fullscreen_viewer(selected_indexes[0])) @@ -4664,11 +4663,11 @@ class MainWindow(QMainWindow): lambda checked=False, df=desktop_file_id_from_gio_mime: subprocess.Popen(["gtk-launch", df, full_path])) - menu.addSeparator() - action_other = menu.addAction(QIcon.fromTheme("applications-other"), - UITexts.OPEN_WITH_OTHER) - action_other.triggered.connect( - lambda: self.open_with_system_chooser(full_path)) + # menu.addSeparator() + # action_other = menu.addAction(QIcon.fromTheme("applications-other"), + # UITexts.OPEN_WITH_OTHER) + # action_other.triggered.connect( + # lambda: self.open_with_system_chooser(full_path)) except Exception: action = menu.addAction(UITexts.CONTEXT_MENU_ERROR_LISTING_APPS) action.setEnabled(False) diff --git a/constants.py b/constants.py index 6c0df4d..8b0c17f 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.21" +PROG_VERSION = "0.9.22" PROG_AUTHOR = "Ignacio Serantes" # --- CACHE SETTINGS --- @@ -904,7 +904,7 @@ _UI_TEXTS = { "CONTEXT_MENU_OPEN": "Open", "CONTEXT_MENU_OPEN_SEARCH_LOCATION": "Open and search location", "CONTEXT_MENU_OPEN_DEFAULT_APP": "Open location with default application", - "CONTEXT_MENU_OPEN_FULLSCREEN_VIEWER": "Open in Fullscreen Viewer", + "CONTEXT_MENU_FULLSCREEN_VIEWER": "Open in Fullscreen Viewer", "CONTEXT_MENU_MOVE_TO": "Move to...", "CONTEXT_MENU_COPY_TO": "Copy to...", "CONTEXT_MENU_ROTATE": "Rotate", @@ -1455,7 +1455,7 @@ _UI_TEXTS = { "CONTEXT_MENU_OPEN": "Abrir", "CONTEXT_MENU_OPEN_SEARCH_LOCATION": "Abrir y buscar en ubicación", "CONTEXT_MENU_OPEN_DEFAULT_APP": "Abrir ubicación con aplicación por defecto", - "CONTEXT_MENU_OPEN_FULLSCREEN_VIEWER": "Abrir con Visor a Pantalla Completa", + "CONTEXT_MENU_FULLSCREEN_VIEWER": "Abrir con Visor a Pantalla Completa", "CONTEXT_MENU_MOVE_TO": "Mover a...", "CONTEXT_MENU_COPY_TO": "Copiar a...", "CONTEXT_MENU_ROTATE": "Girar", @@ -2017,7 +2017,7 @@ _UI_TEXTS = { "CONTEXT_MENU_COPY_FILE": "Copiar URL do Ficheiro", "CONTEXT_MENU_COPY_DIR": "Copiar Ruta do Directorio", "CONTEXT_MENU_PROPERTIES": "Propiedades", - "CONTEXT_MENU_OPEN_FULLSCREEN_VIEWER": "Abrir con Visor a Pantalla Completa", + "CONTEXT_MENU_FULLSCREEN_VIEWER": "Abrir con Visor a Pantalla Completa", "CONTEXT_MENU_NO_APPS_FOUND": "Non se atoparon aplicacións", "CONTEXT_MENU_REGENERATE": "Rexenerar Miniatura", "CONTEXT_MENU_ERROR_LISTING_APPS": "Erro listando aplicacións", diff --git a/imageviewer.py b/imageviewer.py index a3fa876..50de3dd 100644 --- a/imageviewer.py +++ b/imageviewer.py @@ -26,6 +26,7 @@ from PySide6.QtCore import ( Signal, QPoint, QSize, Qt, QMimeData, QUrl, QTimer, QEvent, QRect, Slot, QRectF, QThread, QObject ) +from PySide6.QtDBus import QDBusConnection, QDBusMessage, QDBus from constants import ( APP_CONFIG, DEFAULT_FACE_BOX_COLOR, DEFAULT_PET_BOX_COLOR, DEFAULT_VIEWER_SHORTCUTS, @@ -3437,17 +3438,18 @@ class ImageViewer(QWidget): service, which is common on Linux desktops. """ try: - cmd = [ - "dbus-send", "--session", "--print-reply", - "--dest=org.freedesktop.ScreenSaver", + msg = QDBusMessage.createMethodCall( + "org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver.Inhibit", - "string:bagheeraview", # Application name - "string:Viewing images" # Reason for inhibition - ] - output = subprocess.check_output(cmd, text=True) - # Extract the cookie from the output (e.g., "uint32 12345") - self.inhibit_cookie = int(output.split()[-1]) + "org.freedesktop.ScreenSaver", + "Inhibit" + ) + msg.setArguments(["bagheeraview", "Viewing images"]) + reply = QDBusConnection.sessionBus().call(msg) + if reply.type() == QDBusMessage.ReplyMessage: + self.inhibit_cookie = reply.arguments()[0] + else: + self.inhibit_cookie = None except Exception as e: print(f"{UITexts.ERROR} inhibiting power management: {e}") self.inhibit_cookie = None @@ -3461,13 +3463,14 @@ class ImageViewer(QWidget): """ if hasattr(self, 'inhibit_cookie') and self.inhibit_cookie is not None: try: - subprocess.Popen([ - "dbus-send", "--session", - "--dest=org.freedesktop.ScreenSaver", + msg = QDBusMessage.createMethodCall( + "org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver.UnInhibit", - f"uint32:{self.inhibit_cookie}" - ]) + "org.freedesktop.ScreenSaver", + "UnInhibit" + ) + msg.setArguments([self.inhibit_cookie]) + QDBusConnection.sessionBus().call(msg, QDBus.NoBlock) self.inhibit_cookie = None except Exception as e: print(f"{UITexts.ERROR} uninhibiting: {e}") diff --git a/pyproject.toml b/pyproject.toml index 7872258..2acc9d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "bagheeraview" -version = "0.9.21" +version = "0.9.22" authors = [ { name = "Ignacio Serantes" } ] diff --git a/setup.py b/setup.py index fa1818a..2b3cf39 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="bagheeraview", - version="0.9.21", + version="0.9.22", 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 "