Your IP : 18.191.186.220


Current Path : /lib64/python2.7/site-packages/gi/
Upload File :
Current File : //lib64/python2.7/site-packages/gi/_propertyhelper.pyo

�
QLZc@seddlZddlZddlZejjZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'ddfkr6e(Z)e*Z+ne,Z)e-Z+de.fd��YZ/d�Z0dS(	i����Ni(t	TYPE_NONEtTYPE_INTERFACEt	TYPE_CHARt
TYPE_UCHARtTYPE_BOOLEANtTYPE_INTt	TYPE_UINTt	TYPE_LONGt
TYPE_ULONGt
TYPE_INT64tTYPE_UINT64t	TYPE_ENUMt
TYPE_FLAGSt
TYPE_FLOATtTYPE_DOUBLEtTYPE_STRINGtTYPE_POINTERt
TYPE_BOXEDt
TYPE_PARAMtTYPE_OBJECTt
TYPE_PYOBJECTt
TYPE_GTYPEt	TYPE_STRVtTYPE_VARIANTiitPropertyc
Bs�eZdZiee6ee6ee6e	e
6ee6e
e6Zide6de6de6ee6ee	6ee6ee6de6Ziee6ee6de6d e6ee6ee	6ee6ee6Zi	de6de6de6de6de6de6de6de6de	6Zde fd	��YZ!d!d!d!d!dde#j$d!d!d
�	Z%d�Z&d�Z'd
�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4d�Z5RS("s�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
    iii?ii@tgt
__metaclass__cBseZd�ZRS(cCsdS(Ns<class 'GObject.Property'>((tself((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt__repr__�s(t__name__t
__module__R(((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR�sc

Cs�d|_|dkrt}n|j|�|_|j|�|_|j�t|t	�sjt
d��n||_t|t	�s�t
d��n||_||_
||_|r�|r�|j}n<|r�|r�|j}n#|r|r|j}|j}n|j|�||_|dk	rZ||j�krft
d|j|j�f��qfn|j�}||_|	dk	r�|	|j�kr�t
d|j|j�f��q�n|j�}	|	|_d|_dS(Nsnick must be a stringsblurb must be a strings+Minimum for type %s cannot be lower than %ds,Maximum for type %s cannot be higher than %d(tNonetnametobjectt_type_from_pythonttypet_get_defaulttdefaultt_check_defaultt
isinstancet_basestringt	TypeErrortnicktblurbt__doc__tflagst_readonly_settert_writeonly_gettert_default_gettert_default_settertgettertfsett_get_minimumtminimumt_get_maximumtmaximumt_exc(
RR2tsetterR#R%R*R+R-R5R7((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt__init__�sL		
				

	
			cCs#d|jpdtj|j�fS(Ns<GObject Property %s (%s)>s(uninitialized)(R t_gobjectt	type_nameR#(R((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR�scCsx|dkr|Sd|_y|j|�}Wn!tk
rOtj�d}nX|jrt|j}d|_|�n|S(N(RR8tfgett	Exceptiont	tracebackt	print_exc(Rtinstancetklasstvaluetexc((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt__get__�s	


				cCsY|dkrt�nd|_|j|j|�|jrU|j}d|_|�ndS(N(RR)R8tset_propertyR (RRARCRD((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt__set__�s					cCs
|j|�S(s;Allows application of the getter along with init arguments.(R2(RR=((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt__call__�scCs1|jr$|j|_|j|_n||_|S(s8Set the getter function to fget. For use as a decorator.(R,R+R=(RR=((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR2s
		cCs(||_|js$|jj|_n|S(s8Set the setter function to fset. For use as a decorator.(R3R R=R(RR3((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR9	s		cCs�||jkr|j|St|t�r]t|tjtjtjtjtj	f�r]|j
S|ttt
ttttttttttttttttttt fkr�|St!d|f��dS(NsUnsupported type: %r("t_type_from_pytype_lookupR'R#t
issubclassR;tGObjecttGEnumtGFlagstGBoxedt
GInterfacet	__gtype__RRRRRRRRRR	R
R
RRRRRRRRRRR)(Rttype_((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR"s"		cCs&|dk	r|S|jj|jd�S(N(Rt_default_lookuptgetR#(RR%((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR$'scCs!|j}|j}|tkrF|ttfkrFtd|f��n�|tkrp|dk	rtd��qn�|tkr�|dk	rtd��qn�t	j
|t�r�|dkr�td��qt	j
||�std||f��qn(t	j
|t�r5t	j
||�std||f��qn�t	j
|t
�r�|dk	r�t|t�s{tdt|���nx�|D]7}t|�ttfkr�tdt|���q�q�Wn]t	j
|t�r|dk	rt|d	�st	j
|t�rtd
||f��qndS(Ns%default must be True or False, not %rs)object types does not have default valuess(GType types does not have default valuess%enum properties needs a default values'enum value %s must be an instance of %rs(flags value %s must be an instance of %rsStrv value %s must be a lists'Strv value %s must contain only stringsRPs*variant value %s must be an instance of %r(R#R%RtTruetFalseR)RRRR;t	type_is_aRRRR'tlisttreprtstrtbytesRthasattr(RtptypeR%tval((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR&,s>		
 #cCs|jj|jd�S(N(t_min_value_lookupRSR#R(R((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR4MscCs|jj|jd�S(N(t_max_value_lookupRSR#R(R((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR6PscCst|d|j|�dS(Nt_property_helper_(tsetattrR (RRARC((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR1WscCst|d|j|j�S(NR`(tgetattrR R%(RRA((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR0ZscCs)td|jt|�jf�|_dS(Ns%s property of %s is read-only(R)R R#RR8(RRARC((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR.]scCs)td|jt|�jf�|_dS(Ns%s property of %s is write-only(R)R R#RR8(RRA((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR/asc	Cs|j}|ttttttttfkrH|j	|j
|jf}n�|tks�|t
ks�|jt�s�|jt�s�|jt�r�|jf}nN|ttfkr�d}n3|jt�s�|jt�r�d}nt|��|j|j|jf||jfS(N(((R#RRRRR	R
R
RR5R7R%RRtis_aRRRRRRRtNotImplementedErrorR*R+R-(RR\targs((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytget_pspec_argsis			ll����ll����ll����N(6RRR,Rt_longRtintRtboolRtfloatRRYRR!RIRRR
t
G_MAXFLOATR
tG_MAXDOUBLEtG_MININTt	G_MINLONGR	R^t	G_MAXUINTt
G_MAXULONGtG_MAXINTt	G_MAXLONGR_RRR#RRR;tPARAM_READWRITER:RRERGRHR2R9R"R$R&R4R6R1R0R.R/Rf(((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR3sp6



6							
			!						csv�jjdi�}g}x��jj�D]�\}}t|t�r+|js[||_n|j|kr�||j|j�kr�q+ntd|j��n|j�||j<|j|�q+q+W|s�dS|�_	d�jks�d�jkrHxN|D]C}|j
|jks(|j|j
kr�td�jf��q�q�Wnd�}|�_�fd�}|�_dS(	s�
    Scans the given class for instances of Property and merges them
    into the classes __gproperties__ dict if it exists or adds it if not.
    t__gproperties__s0Property %s was already found in __gproperties__Ntdo_get_propertytdo_set_propertysGObject subclass %r defines do_get/set_property and it also uses a property with a custom setter or getter. This is not allowedcSs%|jjdd�}t||d�S(Nt-t_(R treplaceRbR(RtpspecR ((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytobj_get_property�scsD|jjdd�}t�|d�}|r@|j||�ndS(NRwRx(R RyRbRR3(RRzRCR tprop(tcls(s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytobj_set_property�s(t__dict__RStitemsR'RR Rft
ValueErrortappendRtR=R0R3R1R)RRuRv(R}tgpropertiestpropsR R|R{R~((R}s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytinstall_properties|s2		
$		(1tsysR?tgi._gitgit_giR;t
_constantsRRRRRRRRRR	R
RRR
RRRRRRRRRRRkRlRmRqRoRnRrRptversion_infoRYR(RhRgt
basestringtlongR!RR�(((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyt<module>s(�									�J