3
Ö¸VXÍ
ã @ sl d dl mZ ddlmZ d dlZG dd„ dedƒƒZG dd „ d ed
ƒƒZG dd„ deƒZG d
d„ deƒZ dS )é )ÚGioé )ÚExitableWithAliasesNc @ s e Zd ZejZf Zdd„ ZdS )Ú NameOwnerc s( t j|||||ƒ‰ | j‡ fdd„ƒ d S )Nc s
t jˆ ƒS )N)r Zbus_unown_name© )Úidr ú/usr/lib/python3.6/bus_names.pyÚ s z$NameOwner.__init__..)r Zbus_own_name_on_connectionÚ_at_exit)ÚselfÚconÚnameÚflagsÚname_aquired_handlerÚname_lost_handlerr )r r Ú__init__ s zNameOwner.__init__N)Ú__name__Ú
__module__Ú__qualname__r ZBusNameOwnerFlagsÚFlagsÚ __slots__r r r r r r s r Zunownc @ s e Zd ZejZf Zdd„ ZdS )ÚNameWatcherc s( t j|||||ƒ‰ | j‡ fdd„ƒ d S )Nc s
t jˆ ƒS )N)r Zbus_unwatch_namer )r r r r s z&NameWatcher.__init__..)r Zbus_watch_name_on_connectionr
)r r r
r Úname_appeared_handlerÚname_vanished_handlerr )r r r s zNameWatcher.__init__N)r r r r ZBusNameWatcherFlagsr r r r r r r r
s r Zunwatchc @ s e Zd Zf ZejZddd„ZdS )ÚOwnMixinr Nc sN t jdtƒ ˆ dk r ‡ fdd„nd}ˆdk r8‡fdd„nd}t| j||||ƒS )a7 [DEPRECATED] Asynchronously aquires a bus name.
Starts acquiring name on the bus specified by bus_type and calls
name_acquired and name_lost when the name is acquired respectively lost.
To receive name_aquired and name_lost callbacks, you need an event loop.
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
Parameters
----------
name : string
Bus name to aquire
flags : NameOwnerFlags, optional
name_aquired : callable, optional
Invoked when name is acquired
name_lost : callable, optional
Invoked when name is lost
Returns
-------
NameOwner
An object you can use as a context manager to unown the name later.
See Also
--------
See https://developer.gnome.org/gio/2.44/gio-Owning-Bus-Names.html#g-bus-own-name
for more information.
z5own_name() is deprecated, use request_name() instead.Nc s ˆ ƒ S )Nr )r r
)Úname_aquiredr r r 8 s z#OwnMixin.own_name..c s ˆ ƒ S )Nr )r r
)Ú name_lostr r r 9 s )ÚwarningsÚwarnÚDeprecationWarningr r )r r
r r r r r r )r r r Úown_name s zOwnMixin.own_name)r NN)r r r r r r ZNameOwnerFlagsr r r r r r s r c @ s e Zd Zf ZejZddd„ZdS )Ú
WatchMixinr Nc sB ˆ dk r‡ fdd„nd}ˆdk r,‡fdd„nd}t | j||||ƒS )až Asynchronously watches a bus name.
Starts watching name on the bus specified by bus_type and calls
name_appeared and name_vanished when the name is known to have a owner
respectively known to lose its owner.
To receive name_appeared and name_vanished callbacks, you need an event loop.
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
Parameters
----------
name : string
Bus name to watch
flags : NameWatcherFlags, optional
name_appeared : callable, optional
Invoked when name is known to exist
Called as name_appeared(name_owner).
name_vanished : callable, optional
Invoked when name is known to not exist
Returns
-------
NameWatcher
An object you can use as a context manager to unwatch the name later.
See Also
--------
See https://developer.gnome.org/gio/2.44/gio-Watching-Bus-Names.html#g-bus-watch-name
for more information.
Nc s ˆ |ƒS )Nr )r r
Z
name_owner)Ú
name_appearedr r r _ s z'WatchMixin.watch_name..c s ˆ ƒ S )Nr )r r
)Ú
name_vanishedr r r ` s )r r )r r
r r" r# r r r )r" r# r Ú
watch_name@ s zWatchMixin.watch_name)r NN)r r r r r r ZNameWatcherFlagsr$ r r r r r! <