Skip to content

Commit

Permalink
Migrate to dbus-fast
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo committed Dec 18, 2024
1 parent 4c082e6 commit a4de746
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 59 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2024-12-11: [BREAKING CHANGE] `dbus-next` dependency has been replaced with `dbus-fast`. Update to latest qtile is also required.
2024-11-18: [BUGFIX] Fix square border for `AnalogueClock`
2024-11-14: [FEATURE] Enable support for vertical bars for `GroupBox2`
2024-11-03: [FEATURE] Add `ImageDecoration` for widgets
Expand Down
10 changes: 5 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def __dir__(self):
"cffi",
"dateutil",
"dateutil.parser",
"dbus_next",
"dbus_next.aio",
"dbus_next.service",
"dbus_next.errors",
"dbus_next.constants",
"dbus_fast",
"dbus_fast.aio",
"dbus_fast.service",
"dbus_fast.errors",
"dbus_fast.constants",
"iwlib",
"keyring",
"mpd",
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ setuptools_scm
sphinx
sphinx_rtd_theme
sphinxcontrib-seqdiag
dbus-next
dbus-fast
pulsectl-asyncio
pytest
PyGObject
6 changes: 3 additions & 3 deletions qtile_extras/resources/dbusmenu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from functools import partial
from typing import TYPE_CHECKING

from dbus_next import InterfaceNotFoundError, InvalidIntrospectionError, Variant
from dbus_next.aio import MessageBus
from dbus_next.errors import DBusError
from dbus_fast import InterfaceNotFoundError, InvalidIntrospectionError, Variant
from dbus_fast.aio import MessageBus
from dbus_fast.errors import DBusError
from libqtile.log_utils import logger

from qtile_extras.resources.dbusmenu.dbusmenu import DBUS_MENU_SPEC
Expand Down
10 changes: 5 additions & 5 deletions qtile_extras/resources/global_menu/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
from pathlib import Path
from typing import TYPE_CHECKING

from dbus_next import Message
from dbus_next.aio import MessageBus
from dbus_next.constants import MessageType, PropertyAccess
from dbus_next.service import ServiceInterface, dbus_property, method, signal
from dbus_fast import Message
from dbus_fast.aio import MessageBus
from dbus_fast.constants import MessageType, PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method, signal
from libqtile.core.lifecycle import lifecycle
from libqtile.log_utils import logger
from libqtile.utils import create_task
Expand Down Expand Up @@ -126,7 +126,7 @@ def RegisterWindow(self, windowId: u, menuObjectPath: o): # type: ignore # noq
# This is silly, the spec says that apps should only provide
# windowId and menuObjectPath but we need to be able to return
# the host service too but this isn't explicityly provided
# and dbus-next's high-level service doesn't expose this part of
# and dbus-fast's high-level service doesn't expose this part of
# the message. So... we expose the method here but don't do anything
# with it. We actually deal with the call in a low-level message
# handler, self._message_handler.
Expand Down
2 changes: 1 addition & 1 deletion qtile_extras/widget/globalmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GlobalMenu(base._TextBox, DbusMenuMixin):
("padding", 3, "Padding between items in menu bar"),
] # type: list[tuple[str, Any, str]]

_dependencies = ["dbus-next"]
_dependencies = ["dbus-fast"]

_screenshots = [("globalmenu.png", "Showing VLC menu in the bar.")]

Expand Down
8 changes: 4 additions & 4 deletions qtile_extras/widget/iwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import contextlib
import shutil

from dbus_next.aio import MessageBus
from dbus_next.constants import BusType
from dbus_next.errors import DBusError, InterfaceNotFoundError
from dbus_next.service import ServiceInterface, method
from dbus_fast.aio import MessageBus
from dbus_fast.constants import BusType
from dbus_fast.errors import DBusError, InterfaceNotFoundError
from dbus_fast.service import ServiceInterface, method
from libqtile.command.base import expose_command
from libqtile.log_utils import logger
from libqtile.utils import create_task
Expand Down
2 changes: 1 addition & 1 deletion qtile_extras/widget/statusnotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class StatusNotifier(QtileStatusNotifier, DbusMenuMixin):

_experimental = True

_dependencies = ["dbus-next", "xdg"]
_dependencies = ["dbus-fast", "xdg"]

_screenshots = [("statusnotifier.png", "Widget showing Remmina icon and context menu.")]

Expand Down
6 changes: 3 additions & 3 deletions qtile_extras/widget/unitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import asyncio
import math

from dbus_next.aio import MessageBus
from dbus_next.constants import BusType
from dbus_fast.aio import MessageBus
from dbus_fast.constants import BusType
from libqtile import bar
from libqtile.log_utils import logger
from libqtile.widget import base
Expand Down Expand Up @@ -75,7 +75,7 @@ class UnitStatus(base._Widget, base.PaddingMixin, base.MarginMixin):

_screenshots = [("widget-unitstatus-screenshot.png", "")]

_dependencies = ["dbus-next"]
_dependencies = ["dbus-fast"]

def __init__(self, **config):
base._Widget.__init__(self, bar.CALCULATED, **config)
Expand Down
6 changes: 3 additions & 3 deletions qtile_extras/widget/upower.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import asyncio
from enum import Enum, auto

from dbus_next.aio import MessageBus
from dbus_next.constants import BusType
from dbus_fast.aio import MessageBus
from dbus_fast.constants import BusType
from libqtile import bar
from libqtile.log_utils import logger
from libqtile.widget import base
Expand Down Expand Up @@ -101,7 +101,7 @@ class UPowerWidget(base._Widget):
("battery_textdisplay.gif", "Showing text"),
]

_dependencies = ["dbus-next"]
_dependencies = ["dbus-fast"]

_hooks = [h.name for h in hook.upower_hooks]

Expand Down
10 changes: 5 additions & 5 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from abc import ABCMeta, abstractmethod
from pathlib import Path

from dbus_next import Message, Variant
from dbus_next.aio import MessageBus
from dbus_next.constants import MessageType, PropertyAccess
from dbus_next.service import ServiceInterface, dbus_property, method
from dbus_next.service import signal as dbus_signal
from dbus_fast import Message, Variant
from dbus_fast.aio import MessageBus
from dbus_fast.constants import MessageType, PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method
from dbus_fast.service import signal as dbus_signal
from libqtile import command, config, ipc, layout
from libqtile.confreader import Config
from libqtile.core.manager import Qtile
Expand Down
6 changes: 3 additions & 3 deletions test/widget/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next.aio import MessageBus
from dbus_next.constants import PropertyAccess
from dbus_next.service import ServiceInterface, dbus_property, method
from dbus_fast.aio import MessageBus
from dbus_fast.constants import PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method


@pytest.fixture(scope="function")
Expand Down
6 changes: 3 additions & 3 deletions test/widget/test_brightness_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next import Message, Variant
from dbus_next.aio import MessageBus
from dbus_next.constants import MessageType
from dbus_fast import Message, Variant
from dbus_fast.aio import MessageBus
from dbus_fast.constants import MessageType
from libqtile.log_utils import init_log

import qtile_extras.widget.brightnesscontrol
Expand Down
24 changes: 12 additions & 12 deletions test/widget/test_iwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
from threading import Thread

import pytest
from dbus_next import Variant
from dbus_next._private.address import get_session_bus_address
from dbus_next.aio import MessageBus
from dbus_next.constants import PropertyAccess
from dbus_next.service import ServiceInterface, dbus_property, method
from dbus_fast import Variant
from dbus_fast.aio import MessageBus
from dbus_fast.constants import BusType, PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method
from libqtile.bar import Bar
from libqtile.config import Screen

Expand All @@ -47,6 +46,11 @@
from test.helpers import Retry


class ForceSessionBusType:
SESSION = BusType.SESSION
SYSTEM = BusType.SESSION


class Device(ServiceInterface):
def __init__(self, *args, device_name="", powered=True, **kwargs):
ServiceInterface.__init__(self, IWD_DEVICE, *args, **kwargs)
Expand Down Expand Up @@ -176,7 +180,7 @@ async def start_server(self):
Network(connected=True, name="qtile_extras", known=known_network, network_type="psk"),
)

# We need to include a known network path here otherwise dbus_next will spit out an error about an
# We need to include a known network path here otherwise dbus_fast will spit out an error about an
# invalid path (according to spec, empty strings are not allowed...)
bus.export(open_network, Network(name="open_network", network_type="open", known="/"))
bus.export(eap_network, Network(name="8021x_network", network_type="8021x", known="/"))
Expand Down Expand Up @@ -241,12 +245,8 @@ def dbus_thread(monkeypatch):
@pytest.fixture
def widget(monkeypatch):
"""Patch the widget to use the fake dbus service."""

def force_session_bus(bus_type):
return get_session_bus_address()

# Make dbus_next always return the session bus address even if system bus is requested
monkeypatch.setattr("dbus_next.message_bus.get_bus_address", force_session_bus)
# Make dbus_fast always return the session bus address even if system bus is requested
monkeypatch.setattr("qtile_extras.widget.iwd.BusType", ForceSessionBusType)

yield IWD

Expand Down
8 changes: 4 additions & 4 deletions test/widget/test_mpris2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next.aio import MessageBus
from dbus_next.constants import PropertyAccess
from dbus_next.message import Variant
from dbus_next.service import ServiceInterface, dbus_property, method
from dbus_fast import Variant
from dbus_fast.aio import MessageBus
from dbus_fast.constants import PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method

import qtile_extras.widget.mpris2widget as mp
from test.helpers import Retry
Expand Down
2 changes: 1 addition & 1 deletion test/widget/test_statusnotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next.errors import InterfaceNotFoundError, InvalidIntrospectionError
from dbus_fast.errors import InterfaceNotFoundError, InvalidIntrospectionError
from libqtile.log_utils import init_log

import qtile_extras.resources.dbusmenu
Expand Down
4 changes: 2 additions & 2 deletions test/widget/test_unitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next import Variant
from dbus_next.constants import BusType
from dbus_fast import Variant
from dbus_fast.constants import BusType
from libqtile.log_utils import init_log
from libqtile.widget import base

Expand Down
2 changes: 1 addition & 1 deletion test/widget/test_upower.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_next.constants import BusType
from dbus_fast.constants import BusType

from qtile_extras.widget.upower import UPowerWidget
from test.helpers import Retry # noqa: I001
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ deps =
# CI has libxcommon-dev 1.4.0 so we need to match here
xkbcommon < 1.5.0
pywayland == 0.4.17
dbus-next
dbus-fast
PyGObject
requests
pint
Expand Down Expand Up @@ -77,7 +77,7 @@ deps =
# CI has libxkbcommon 1.4.0
xkbcommon < 1.5.0
pywayland == 0.4.17
dbus_next
dbus_fast
requests
pint
stravalib <= 1.1.0
Expand Down

0 comments on commit a4de746

Please sign in to comment.