HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/gi/__pycache__/_propertyhelper.cpython-38.pyc
U

��	^�7�@s�ddlmZddlmZmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%Gdd�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@sNeZdZdZeeeeee	e
eee
eeiZedededeeeeeeeeediZeeeeededeeeeeeeeiZedededededede
dededi	Z Gdd	�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�����gc@seZdZdd�ZdS)zProperty.__metaclass__cCsdS)Nz<class 'GObject.Property'>���selfr r �4/usr/lib/python3/dist-packages/gi/_propertyhelper.py�__repr__�szProperty.__metaclass__.__repr__N)�__name__�
__module__�__qualname__r$r r r r#�
__metaclass__�sr(Nc

Cs4d|_|dkrt}|�|�|_|�|�|_|��t|t�sDt	d��||_
t|t�s\t	d��||_||_||_
|r~|s~|j}n$|r�|s�|j}n|s�|s�|j}|j}|�|�||_|dk	r�||��kr�t	d|j|��f��n|��}||_|	dk	�r|	|��k�r$t	d|j|��f��n|��}	|	|_d|_dS)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"r:�setterr,r.r2r3r5r=r?r r r#�__init__�sT


��
��zProperty.__init__cCsd|jp
d|jjfS)Nz<GObject Property %s (%s)>z(uninitialized))r)r,r!r r r#r$�s�zProperty.__repr__cCs6|dkr|Sd|_|�|�}|jr2|j}d|_|�|S�N)r@�fget)r"�instance�klass�value�excr r r#�__get__�s
zProperty.__get__cCs:|dkrt�d|_|�|j|�|jr6|j}d|_|�dSrC)r1r@Zset_propertyr))r"rErGrHr r r#�__set__�szProperty.__set__cCs
|�|�S)z;Allows application of the getter along with init arguments.)r:�r"rDr r r#�__call__�szProperty.__call__cCs |jr|j|_|j|_||_|S)z8Set the getter function to fget. For use as a decorator.)r4r3rDrKr r r#r:�s
zProperty.gettercCs||_|js|jj|_|S)z8Set the setter function to fset. For use as a decorator.)r;r)rDr%)r"r;r r r#rA�s
zProperty.settercCs�||jkr|j|St|t�rBt|tjtjtjtjtj	f�rB|j
S|ttt
ttttttttttttttttttt fkrz|St!d|f��dS)NzUnsupported type: %r)"�_type_from_pytype_lookupr0r,�
issubclassrZGObjectZGEnumZGFlagsZGBoxedZ
GInterface�	__gtype__rrrrr
rr	rr
rrrrrrrrrrrrrr1)r"Ztype_r r r#r+�sB


��
�zProperty._type_from_pythoncCs|dk	r|S|j�|jd�SrC)�_default_lookup�getr,)r"r.r r r#r-szProperty._get_defaultcCsz|j}|j}|tkr.|dkr.td|f���nH|tkrJ|dk	rFtd���n,|tkrf|dk	rbtd���n|�t�r�|dkr�td��n t�	|��|�s�td||f��n�|�t
�r�t�	|��|�s�td||f��n�|�t��r2|dk	�r2t|t
��stdt|���|D](}t|�ttfk�rtd	t|����qnD|�t��rv|dk	�rvt|d
��rft�	|��t��svtd||f��dS)N)TFz%default must be True or False, not %rz)object types does not have default valuesz(GType types does not have default valuesz%enum properties needs a default valuez'enum value %s must be an instance of %rz(flags value %s must be an instance of %rzStrv value %s must be a listz'Strv value %s must contain only stringsrOz*variant value %s must be an instance of %r)r,r.r	r1rr�is_arrZGTyperrr0�list�repr�str�bytesr�hasattr)r"�ptyper.�valr r r#r/sF�

�
��zProperty._check_defaultcCs|j�|jd�SrC)�_min_value_lookuprQr,r!r r r#r<6szProperty._get_minimumcCs|j�|jd�SrC)�_max_value_lookuprQr,r!r r r#r>9szProperty._get_maximumcCst|d|j|�dS�NZ_property_helper_)�setattrr)�r"rErGr r r#r9@szProperty._default_settercCst|d|j|j�Sr\)�getattrr)r.�r"rEr r r#r8CszProperty._default_gettercCstd|jt|�jf�|_dS)Nz%s property of %s is read-only�r1r)r,r%r@r^r r r#r6Fs�zProperty._readonly_settercCstd|jt|�jf�|_dS)Nz%s property of %s is write-onlyrar`r r r#r7Js�zProperty._writeonly_getterc	Cs�|j}|ttttttttfkr0|j	|j
|jf}nl|tks^|t
ks^|�t�s^|�t�s^|�t�rh|jf}n4|ttfkrzd}n"|�t�s�|�t�r�d}nt|��|j|j|jf||jfS)Nr )r,r
rrr
rrrrr=r?r.rr	rRrrrrrrr�NotImplementedErrorr2r3r5)r"rX�argsr r r#�get_pspec_argsRs,
����
zProperty.get_pspec_args)6r%r&r'r4rr�intr
�boolr	�floatrrUrr*rrMrr
rr�
G_MAXFLOAT�G_MAXDOUBLE�G_MININT�	G_MINLONGrrZ�	G_MAXUINT�
G_MAXULONG�G_MAXINT�	G_MAXLONGr[rPr,r(rZPARAM_READWRITErBr$rIrJrLr:rAr+r-r/r<r>r9r8r6r7rdr r r r#r(s�8��
���
8
	
!rcs��j�di�}g}�j��D]b\}}t|t�r|js:||_|j|krf||j|��krXqtd|j��|��||j<|�|�q|s�dS|�_	d�jks�d�jkr�|D],}|j
|jks�|j|j
kr�td�jf��q�dd�}|�_�fd	d
�}|�_dS)z�
    Scans the given class for instances of Property and merges them
    into the classes __gproperties__ dict if it exists or adds it if not.
    �__gproperties__z0Property %s was already found in __gproperties__N�do_get_property�do_set_propertyzGObject subclass %r defines do_get/set_property and it also uses a property with a custom setter or getter. This is not allowedcSs|j�dd�}t||d�S�N�-�_)r)�replacer_)r"�pspecr)r r r#�obj_get_property�sz,install_properties.<locals>.obj_get_propertycs.|j�dd�}t�|d�}|r*|�||�dSrs)r)rvr_r;)r"rwrGr)�prop��clsr r#�obj_set_property�sz,install_properties.<locals>.obj_set_property)�__dict__rQ�itemsr0rr)rd�
ValueError�appendrprDr8r;r9r1r%rqrr)r{ZgpropertiesZpropsr)ryrxr|r rzr#�install_propertieses6

��r�N))rrZ_compatrrZ
_constantsrrrrr	r
rrr
rrrrrrrrrrrrrrrrhrirjrnrlrkrormr*rr�r r r r#�<module>sh?