Merge pull request 'refs #2060 launch QT6 browser, use dbus to change URLs' (#35) from browser-nuevo into main

Reviewed-on: #35
main 5.6.0
Natalia Serrano 2025-05-21 16:05:40 +02:00
commit d1ce3b5cc9
4 changed files with 33 additions and 8 deletions

View File

@ -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/), 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). 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 ## [5.5.0] - 2025-05-19
### Changed ### Changed

View File

@ -1,3 +1,10 @@
ogagent (5.6.0-1) stable; urgency=medium
* Execute 'launch_browser' rather than 'browser'
* Change URLs using dbus
-- OpenGnsys developers <info@opengnsys.es> Wed, 21 May 2025 15:06:52 +0200
ogagent (5.5.0-1) stable; urgency=medium ogagent (5.5.0-1) stable; urgency=medium
* Return to the QT4 browser again * Return to the QT4 browser again

View File

@ -1 +1 @@
5.5.0 5.6.0

View File

@ -33,6 +33,7 @@
import os import os
import re import re
import time import time
import dbus
import random import random
import subprocess import subprocess
import threading import threading
@ -369,15 +370,25 @@ class ogLiveWorker(ServerWorker):
def cargaPaginaWeb (self, url=None): def cargaPaginaWeb (self, url=None):
if (not url): url = self.urlMenu 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: try:
p.wait (2) ## if the process dies before 2 seconds... b.call_blocking (dest, path, interface, method, 's', [url])
logger.error ('Error al ejecutar browser, return code "{}"'.format (p.returncode)) except Exception as e:
return False if 'ServiceUnknown' in str(e):
except subprocess.TimeoutExpired: ## browser not running
pass subprocess.Popen (['/usr/bin/launch_browser', url])
else:
logger.error (f'Error al cambiar URL: ({e})')
return False
return True return True