Skip to content

Commit

Permalink
Fix properties changed signal emitting wrong paths
Browse files Browse the repository at this point in the history
  • Loading branch information
igo95862 committed Aug 13, 2022
1 parent 0b22970 commit 624e611
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/sdbus/dbus_proxy_async_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,11 @@ class DbusPropertiesInterfaceAsync(
def __init__(self) -> None:
super().__init__()

properties_changed_signal = self.properties_changed
for key, value in getmembers(self):
if isinstance(value, DbusPropertyAsyncBinded):
if not value.dbus_property.flags & DbusPropertyEmitsChangeFlag:
continue

value.dbus_property.properties_changed_signal \
= properties_changed_signal

@dbus_signal_async('sa{sv}as')
def properties_changed(self) -> DBUS_PROPERTIES_CHANGED_TYPING:
...
Expand Down
22 changes: 7 additions & 15 deletions src/sdbus/dbus_proxy_async_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
TYPE_CHECKING,
Any,
Callable,
Dict,
Generator,
Generic,
List,
Optional,
Tuple,
Type,
TypeVar,
cast,
Expand All @@ -50,12 +47,6 @@

if TYPE_CHECKING:
from .dbus_proxy_async_interface_base import DbusInterfaceBaseAsync
from .dbus_proxy_async_signal import DbusSignalBinded


DBUS_PROPERTIES_CHANGED_TYPING = Tuple[str,
Dict[str, Tuple[str, Any]],
List[str]]


class DbusPropertyAsync(DbusSomethingAsync, DbusPropertyCommon, Generic[T]):
Expand Down Expand Up @@ -84,9 +75,6 @@ def __init__(
Callable[[DbusInterfaceBaseAsync, T],
None]] = property_setter

self.properties_changed_signal: \
Optional[DbusSignalBinded[DBUS_PROPERTIES_CHANGED_TYPING]] = None

self.__doc__ = property_getter.__doc__

def __get__(self,
Expand Down Expand Up @@ -167,9 +155,13 @@ def _reply_set_sync(self, message: SdBusMessage) -> None:

self.dbus_property.property_setter(interface, data_to_set_to)

if self.dbus_property.properties_changed_signal is not None:
assert self.dbus_property.interface_name is not None
self.dbus_property.properties_changed_signal.emit(
assert self.dbus_property.interface_name is not None
try:
properties_changed = getattr(interface, 'properties_changed')
except AttributeError:
...
else:
properties_changed.emit(
(
self.dbus_property.interface_name,
{
Expand Down

0 comments on commit 624e611

Please sign in to comment.