3
Ö¸VXv ã @ sB d dl mZ ddlmZ G dd„ deddƒƒZG dd „ d eƒZd
S )é )ÚGioé )ÚExitableWithAliasesc @ s e Zd ZejZf Zdd„ ZdS )ÚSubscriptionc s. ˆ j |||||||ƒ‰| j‡ ‡fdd„ƒ d S )Nc s
ˆ j ˆƒS )N)Zsignal_unsubscribe© )ÚconÚidr ú"/usr/lib/python3.6/subscription.pyÚ
s z'Subscription.__init__..)Zsignal_subscribeZ_at_exit) Úselfr ÚsenderÚifaceÚmemberÚobjectÚarg0ÚflagsÚcallbackr )r r r Ú__init__ s zSubscription.__init__N)Ú__name__Ú
__module__Ú__qualname__r ZDBusSignalFlagsÚFlagsÚ __slots__r r r r r r s r ZunsubscribeZ
disconnectc @ s e Zd Zf ZejZddd„ZdS )ÚSubscriptionMixinNr c s4 ˆ dk r‡ fdd„ndd„ }t | j|||||||ƒS )a Subscribes to matching signals.
Subscribes to signals on connection and invokes signal_fired callback
whenever the signal is received.
To receive signal_fired callback, you need an event loop.
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
Parameters
----------
sender : string, optional
Sender name to match on (unique or well-known name) or None to listen from all senders.
iface : string, optional
Interface name to match on or None to match on all interfaces.
signal : string, optional
Signal name to match on or None to match on all signals.
object : string, optional
Object path to match on or None to match on all object paths.
arg0 : string, optional
Contents of first string argument to match on or None to match on all kinds of arguments.
flags : SubscriptionFlags, optional
signal_fired : callable, optional
Invoked when there is a signal matching the requested data.
Parameters: sender, object, iface, signal, params
Returns
-------
Subscription
An object you can use as a context manager to unsubscribe from the signal later.
See Also
--------
See https://developer.gnome.org/gio/2.44/GDBusConnection.html#g-dbus-connection-signal-subscribe
for more information.
Nc s ˆ |||||j ƒ ƒS )N)Úunpack)r r r r
ÚsignalZparams)Úsignal_firedr r r
4 s z-SubscriptionMixin.subscribe..c W s d S )Nr )Úargsr r r r
4 s )r r ) r r r
r r r r r r r )r r Ú subscribe s $zSubscriptionMixin.subscribe)NNNNNr N)r r r r r r ZSubscriptionFlagsr r r r r r s r N)Z
gi.repositoryr Zexitabler r r r r r r r Ú s