feat: Add session bus option for local testing and development

Introduced a `--use-session-bus` flag to optionally use the D-Bus
session bus instead of the system bus. This allows better flexibility
for local testing and development scenarios without requiring
system-level changes. Updated related classes and functions to respect
the new flag.
This commit is contained in:
2025-04-19 09:33:54 +02:00
parent a4ccb9081f
commit bde3920fc1
4 changed files with 19 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ from logging import getLogger
from threading import Thread
from gi.repository import GLib
from pydbus import SystemBus
from pydbus import SessionBus, SystemBus
from . import REVPI_DBUS_NAME
from .process_image import InterfacePiControl
@@ -20,11 +20,12 @@ class BusProvider(Thread):
self,
picontrol_device="/dev/piControl0",
config_rsc="/etc/revpi/config.rsc",
use_system_bus=True,
):
log.debug("enter BusProvider.__init__")
super().__init__()
self._bus = SystemBus()
self._bus = SystemBus() if use_system_bus else SessionBus()
self._loop = GLib.MainLoop()
self.picontrol_device = picontrol_device