Mini Shell
3
��^ � @ s� d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z m
Z
d dlmZm
Z
d dlmZmZmZmZ dd d
gZdd� ZG dd � d e�ZG d
d� de�ZG dd
� d
ed�ZdS )� )�ABCMeta)�defaultdict)�wraps)�Dict)�dbus_signal�get_xml)�DBusSpecification�DBusSpecificationError)�get_variant�Str�Variant�List�emits_properties_changed�PropertiesException�PropertiesInterfacec s t � �� fdd��}|S )a" Decorator for emitting properties changes.
The decorated method has to be a member of a class that
inherits PropertiesInterface.
:param method: a DBus method of a class that inherits PropertiesInterface
:return: a wrapper of a DBus method that emits PropertiesChanged
c s � | f|�|�}| j � |S )N)�
flush_changes)�obj�args�kwargs�result)�method� �/usr/lib/python3.6/property.py�wrapper1 s z)emits_properties_changed.<locals>.wrapper)r )r r r )r r r ( s c @ s e Zd ZdZdS )r zException for DBus properties.N)�__name__�
__module__�__qualname__�__doc__r r r r r : s c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�PropertiesChangesz�Cache for properties changes.
This class is useful to collect the changed properties
and their values, before they are emitted on DBus.
c C s || _ t� | _| j|�| _dS )zNCreate the cache.
:param obj: an object with DBus properties
N)�_object�set�_properties_names�_find_properties_specs�_properties_specs)�selfr r r r �__init__F s zPropertiesChanges.__init__c C sX t jt|��}i }x@|jD ]6}t|t j�s,q|j|krFtdj|j���|||j<