File: //lib/python3/dist-packages/gi/__pycache__/_propertyhelper.cpython-38.pyc
U
�� ^�7 � @ s� d dl mZ d dlmZmZ d dlmZmZmZm Z m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%G dd� de&�Z'dd� Z(dS ) � )�_gi)�string_types�long_)� TYPE_NONE�TYPE_INTERFACE� TYPE_CHAR�
TYPE_UCHAR�TYPE_BOOLEAN�TYPE_INT� TYPE_UINT� TYPE_LONG�
TYPE_ULONG�
TYPE_INT64�TYPE_UINT64� TYPE_ENUM�
TYPE_FLAGS�
TYPE_FLOAT�TYPE_DOUBLE�TYPE_STRING�TYPE_POINTER�
TYPE_BOXED�
TYPE_PARAM�TYPE_OBJECT�
TYPE_PYOBJECT�
TYPE_GTYPE� TYPE_STRV�TYPE_VARIANTc @ sN e Zd ZdZeeeeee e
eee
eeiZedededee ee eeeeediZeeeeededeeeeeeeeiZedededededede
dededi Z G dd � d e!�Z"d
d
d
d
dde#j$d
d
f dd�Z%d
d� Z&dd� Z'dd� Z(dd� Z)dd� Z*dd� Z+dd� Z,dd� Z-dd� Z.dd � Z/d!d"� Z0d#d$� Z1d%d&� Z2d'd(� Z3d)d*� Z4d+d,� Z5d
S )-�Propertya� Creates a new Property which when used in conjunction with
GObject subclass will create a Python property accessor for the
GObject ParamSpec.
:param callable getter:
getter to get the value of the property
:param callable setter:
setter to set the value of the property
:param type type:
type of property
:param default:
default value, must match the property type.
:param str nick:
short description
:param str blurb:
long description
:param GObject.ParamFlags flags:
parameter flags
:keyword minimum:
minimum allowed value (int, float, long only)
:keyword maximum:
maximum allowed value (int, float, long only)
.. code-block:: python
class MyObject(GObject.Object):
prop = GObject.Property(type=str)
obj = MyObject()
obj.prop = 'value'
obj.prop # now is 'value'
The API is similar to the builtin :py:func:`property`:
.. code-block:: python
class AnotherObject(GObject.Object):
value = 0
@GObject.Property
def prop(self):
'Read only property.'
return 1
@GObject.Property(type=int)
def propInt(self):
'Read-write integer property.'
return self.value
@propInt.setter
def propInt(self, value):
self.value = value
� l���� l ���� l ���� � g c @ s e Zd Zdd� ZdS )zProperty.__metaclass__c C s dS )Nz<class 'GObject.Property'>� ��selfr r �4/usr/lib/python3/dist-packages/gi/_propertyhelper.py�__repr__� s zProperty.__metaclass__.__repr__N)�__name__�
__module__�__qualname__r$ r r r r# �
__metaclass__� s r( Nc
C s4 d | _ |d krt}| �|�| _| �|�| _| �� t|t�sDt d��|| _
t|t�s\t d��|| _|| _|| _
|r~|s~| j}n$|r�|s�| j}n|s�|s�| j}| j}| �|� || _|d k r�|| �� k r�t d| j| �� f ��n| �� }|| _| d k �r| | �� k�r$t d| j| �� f ��n| �� } | | _d | _d S )Nznick must be a stringzblurb must be a stringz+Minimum for type %s cannot be lower than %dz,Maximum for type %s cannot be higher than %d)�name�object�_type_from_python�type�_get_default�default�_check_default�
isinstancer � TypeError�nick�blurb�__doc__�flags�_readonly_setter�_writeonly_getter�_default_getter�_default_setter�getter�fset�_get_minimum�minimum�_get_maximum�maximum�_exc)
r"