From 1fa2a4f0bb29a54e3ccfc0f0c9a398f7acf80a19 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Wed, 21 May 2025 16:02:46 +0200 Subject: [PATCH] refs #2060 launch QT6 browser, use dbus to change URLs --- CHANGELOG.md | 7 +++++++ linux/debian/changelog | 7 +++++++ src/VERSION | 2 +- src/opengnsys/workers/oglive_worker.py | 25 ++++++++++++++++++------- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59ebbd1..7da5077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.6.0] - 2025-05-21 + +### Changed + +- Launch QT6 browser +- Change URLs using dbus + ## [5.5.0] - 2025-05-19 ### Changed diff --git a/linux/debian/changelog b/linux/debian/changelog index b00af66..6a85cf3 100644 --- a/linux/debian/changelog +++ b/linux/debian/changelog @@ -1,3 +1,10 @@ +ogagent (5.6.0-1) stable; urgency=medium + + * Execute 'launch_browser' rather than 'browser' + * Change URLs using dbus + + -- OpenGnsys developers Wed, 21 May 2025 15:06:52 +0200 + ogagent (5.5.0-1) stable; urgency=medium * Return to the QT4 browser again diff --git a/src/VERSION b/src/VERSION index d50359d..1bc788d 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -5.5.0 +5.6.0 diff --git a/src/opengnsys/workers/oglive_worker.py b/src/opengnsys/workers/oglive_worker.py index f2f25f1..64e7bf0 100644 --- a/src/opengnsys/workers/oglive_worker.py +++ b/src/opengnsys/workers/oglive_worker.py @@ -33,6 +33,7 @@ import os import re import time +import dbus import random import subprocess import threading @@ -369,15 +370,25 @@ class ogLiveWorker(ServerWorker): def cargaPaginaWeb (self, url=None): if (not url): url = self.urlMenu - os.system ('pkill -9 browser') - p = subprocess.Popen (['/usr/bin/browser', '-qws', url]) + dbus_address = os.environ.get ('DBUS_SESSION_BUS_ADDRESS') + if not dbus_address: logger.warning ('env var DBUS_SESSION_BUS_ADDRESS not set, cargaPaginaWeb() will likely not work') + + b = dbus.SystemBus() + dest = 'es.opengnsys.OGBrowser.browser' + path = '/' + interface = None + method = 'setURL' + signature = 's' try: - p.wait (2) ## if the process dies before 2 seconds... - logger.error ('Error al ejecutar browser, return code "{}"'.format (p.returncode)) - return False - except subprocess.TimeoutExpired: - pass + b.call_blocking (dest, path, interface, method, 's', [url]) + except Exception as e: + if 'ServiceUnknown' in str(e): + ## browser not running + subprocess.Popen (['/usr/bin/launch_browser', url]) + else: + logger.error (f'Error al cambiar URL: ({e})') + return False return True