Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/gi/_gobject/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyc


-Oc@s.ddlZddlmZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZddlmZmZmZmZmZmZmZm Z m!Z!m"Z"ej#d
kre$Z%e&Z'ne(Z%e)Z'de*fd	YZ+dS(iNi(t_gobject(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_PYOBJECT(
t
G_MINFLOATt
G_MAXFLOATtG_MINDOUBLEtG_MAXDOUBLEtG_MININTtG_MAXINTt	G_MAXUINTt	G_MINLONGt	G_MAXLONGt
G_MAXULONGiitPropertyc
BseZdZdefdYZddddddejddd	ZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZRS(s
    Creates a new property which in conjunction with GObject subclass will
    create a property proxy:

    >>> class MyObject(GObject.GObject):
    >>> ... prop = GObject.Property(type=str)

    >>> obj = MyObject()
    >>> obj.prop = 'value'

    >>> obj.prop
    'value'

    The API is similar to the builtin property:

    class AnotherObject(GObject.GObject):
        @GObject.Property
        def prop(self):
            '''Read only property.'''
            return ...

        @GObject.Property(type=int)
        def propInt(self):
            '''Read-write integer property.'''
            return ...

        @propInt.setter
        def propInt(self, value):
            ...
    t
__metaclass__cBseZdZRS(cCsdS(Ns<class 'GObject.Property'>((tself((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt__repr__Ns(t__name__t
__module__R#(((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR!Mstc

Cs|dkrt}n|j||_|j||_|jt|tsat	dn||_
t|tst	dn||_|dks|dkrt	d|fn||_|r|r|j
}n<|r|r|j}n#|r|r|j}|j}n|j||j||dk	rz||jkrt	d|j|jfqn|j}||_|	dk	r|	|jkrt	d|j|jfqn|j}	|	|_d|_d|_dS(	s`
        @param  getter: getter to get the value of the property
        @type   getter: callable
        @param  setter: setter to set the value of the property
        @type   setter: callable
        @param    type: type of property
        @type     type: type
        @param default: default value
        @param    nick: short description
        @type     nick: string
        @param   blurb: long description
        @type    blurb: string
        @param flags:    parameter flags, one of:
        - gobject.PARAM_READABLE
        - gobject.PARAM_READWRITE
        - gobject.PARAM_WRITABLE
        - gobject.PARAM_CONSTRUCT
        - gobject.PARAM_CONSTRUCT_ONLY
        - gobject.PARAM_LAX_VALIDATION
        @keyword minimum:  minimum allowed value (int, float, long only)
        @keyword maximum:  maximum allowed value (int, float, long only)
        snick must be a stringsblurb must be a stringii sinvalid flag value: %rs+Minimum for type %s cannot be lower than %ds,Maximum for type %s cannot be higher than %dN(tNonetobjectt_type_from_pythonttypet_get_defaulttdefaultt_check_defaultt
isinstancet_basestringt	TypeErrortnicktblurbtflagst_readonly_settert_writeonly_gettert_default_gettert_default_settertgettertsettert_get_minimumtminimumt_get_maximumtmaximumtnamet_exc(
R"R8R9R*R,R1R2R3R;R=((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt__init__QsN	
			

	

			cCs#d|jpdtj|jfS(Ns<GObject Property %s (%s)>s(uninitialized)(R>Rt	type_nameR*(R"((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR#scCsS|dkr|Sd|_|j|j}|jrO|j}d|_|n|S(N(R'R?tget_propertyR>(R"tinstancetklasstvaluetexc((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt__get__s					cCsY|dkrtnd|_|j|j||jrU|j}d|_|ndS(N(R'R0R?tset_propertyR>(R"RCRERF((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt__set__s					cCs
|j|S(s;Allows application of the getter along with init arguments.(R8(R"tfget((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt__call__scCsM|jdkr|j|_n|jr@|jr@|j|_n||_|S(s8Set the getter function to fget. For use as a decorator.N(t__doc__R'R2RJ(R"RJ((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR8s	cCs
||_|S(s8Set the setter function to fset. For use as a decorator.(tfset(R"RM((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR9s	cCs|tkrtS|tkr tS|tkr0tS|tkr@tS|tkrPt	S|t
kr`tSt|t
rt|tjtjtjfr|jS|ttttttttttttttttt t	tgkr|St!d|fdS(NsUnsupported type: %r("t_longRtintRtboolRtfloatRtstrRR(RR.R*t
issubclassRtGObjecttGEnumtGBoxedt	__gtype__RRRRRR	R
RRRRRRR0(R"ttype_((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR)s2		cCso|j}|dk	r|S|ttttttgkr;dS|tkrKdS|t	ksc|t
krgdSdSdS(NiR&g(R*R'RRRR	R
RRRR(R"R,tptype((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR+s	cCs|j}|j}|tkrF|ttfkrFtd|fn|tkrp|dk	rtdqn[tj	|t
r|dkrtdqtj	||std||fqndS(Ns%default must be True or False, not %rs)object types does not have default valuess%enum properties needs a default values'enum value %s must be an instance of %r(R*R,RtTruetFalseR0RR'Rt	type_is_aR(R"RYR,((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR-s		cCsx|j}|tttgkr"dS|tkr3tS|tkrDtS|tkrTt	S|t
krdtS|tkrtdSdS(Niii>iI@II(R*RR	RRRRRRRRRR
R'(R"RY((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR:s	cCs|j}|tkrtS|tkr)tS|tkr9dS|tkrIdS|tkrYtS|t	krit
S|tkrytS|t
krtSdS(	Nii>ii?I@I?ll(R*RRR	RR
RRRRRRRRRR'(R"RY((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR<s$	cCst|d|j|dS(Nt_property_helper_(tsetattrR>(R"RCRE((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR72scCst|d|j|jS(NR](tgetattrR>R,(R"RC((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR65scCs)td|jt|jf|_dS(Ns%s property of %s is read-only(R0R>R*R$R?(R"RCRE((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR48scCs)td|jt|jf|_dS(Ns%s property of %s is write-only(R0R>R*R$R?(R"RC((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR5<sc	Cs|j}|ttttttttgkrH|j	|j
|jf}n~|tkso|t
kso|jtr~|jf}nH|tkrd}n3|jts|jtrd}nt||j|j|jf||jfS(N(((R*RRRR	R
RRRR;R=R,RRtis_aRRRRtNotImplementedErrorR1R2R3(R"RYtargs((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pytget_pspec_argsDs			N(R$R%RLR*R!R'RtPARAM_READWRITER@R#RGRIRKR8R9R)R+R-R:R<R7R6R4R5Rc(((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyR -s*J		
														(ii(,tsysR&Rt	constantsRRRRRRRRR	R
RRR
RRRRRRRRRRRRRRRRRRtversion_infoRRR/RORNt
basestringtlongR(R (((s>/usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyt<module>sF