crystalfontz.dbus.client

This module contains the core DbusClient abstraction, which is used to interact with a DBus service.

For information on how to use crystalfontz domain objects with the DBus client, see the API docs for crystalfontz.dbus.domain. For examples of how to use the DBus client, look at the source code for crystalfontzctl.

DbusClient

Bases: DbusInterface

A DBus client for the Crystalfontz device.

Source code in crystalfontz/dbus/client/__init__.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class DbusClient(DbusInterface):
    """
    A DBus client for the Crystalfontz device.
    """

    def __init__(
        self: Self,
        bus: Optional[SdBus] = None,
        report_handler: Optional[DbusClientReportHandler] = None,
    ) -> None:
        client = Mock(name="client", side_effect=NotImplementedError("client"))
        self.subscribe = Mock(name="client.subscribe")
        self._effect_client: Optional[DbusEffectClient] = None

        super().__init__(client, report_handler=report_handler)

        cast(Any, self)._proxify(DBUS_NAME, "/", bus=bus)

    async def staged_config(self: Self) -> StagedConfig:
        """
        Fetch the state of staged configuration changes.
        """

        active_config: Config = ConfigM.unpack(await self.config)

        return StagedConfig(
            target_config=Config.from_file(active_config.file),
            active_config=active_config,
        )

staged_config() async

Fetch the state of staged configuration changes.

Source code in crystalfontz/dbus/client/__init__.py
32
33
34
35
36
37
38
39
40
41
42
async def staged_config(self: Self) -> StagedConfig:
    """
    Fetch the state of staged configuration changes.
    """

    active_config: Config = ConfigM.unpack(await self.config)

    return StagedConfig(
        target_config=Config.from_file(active_config.file),
        active_config=active_config,
    )