ó >–Sc@s7ddlZddlZejdZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZddlmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ej%d kre&Z'e(Z)n e*Z'e+Z)de,fd„ƒYZ-dS( iÿÿÿÿNsgobject._gobject(t TYPE_NONEtTYPE_INTERFACEt TYPE_CHARt TYPE_UCHARt TYPE_BOOLEANtTYPE_INTt TYPE_UINTt TYPE_LONGt TYPE_ULONGt TYPE_INT64t TYPE_UINT64t TYPE_ENUMt TYPE_FLAGSt TYPE_FLOATt TYPE_DOUBLEt TYPE_STRINGt TYPE_POINTERt TYPE_BOXEDt TYPE_PARAMt TYPE_OBJECTt TYPE_PYOBJECT( t G_MINFLOATt G_MAXFLOATt G_MINDOUBLEt G_MAXDOUBLEtG_MININTtG_MAXINTt G_MAXUINTt G_MINLONGt G_MAXLONGt G_MAXULONGiitpropertyc BsÀeZdZdefd„ƒYZddddddejddd„ Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„ZRS(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): return ... Which will create a read-only property called prop. t __metaclass__cBseZd„ZRS(cCsdS(Ns((tself((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyt__repr__Gs(t__name__t __module__R"(((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR Fstc Csõ|r| r|j}n<|r2| r2|j}n#| rU| rU|j}|j}n||_||_|dkr|t}n|j|ƒ|_ |j |ƒ|_ |j ƒt |tƒsÈtdƒ‚n||_t |tƒsïtdƒ‚n||_|dks|dkr&td|fƒ‚n||_|dk rr||jƒkr~td|j |jƒfƒ‚q~n |jƒ}||_| dk rÊ| |jƒkrÖtd|j |jƒfƒ‚qÖn |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 bick: 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(t_readonly_settert_writeonly_gettert_default_gettert_default_settertgettertsettertNonetobjectt_type_from_pythonttypet _get_defaulttdefaultt_check_defaultt isinstancet _basestringt TypeErrortnicktblurbtflagst _get_minimumtminimumt _get_maximumtmaximumtnamet_exc( R!R*R+R/R1R6R7R8R:R<((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyt__init__JsN                     cCs#d|jpdtj|jƒfS(Nss(uninitialized)(R=t_gobjectt type_nameR/(R!((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR"•s cCsS|dkr|Sd|_|j|jƒ}|jrO|j}d|_|‚n|S(N(R,R>t get_propertyR=(R!tinstancetklasstvaluetexc((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyt__get__šs      cCsY|dkrt‚nd|_|j|j|ƒ|jrU|j}d|_|‚ndS(N(R,R5R>t set_propertyR=(R!RCRERF((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyt__set__§s      cCsî|tkrtS|tkr tS|tkr0tS|tkr@tS|tkrPt S|t kr`t St |t ƒrˆt|tjƒrˆ|jS|ttttttttttttttttttt t t gkr×|St!d|fƒ‚dS(NsUnsupported type: %r("t_longRtintRtboolRtfloatRtstrRR-RR3R/t issubclassR@tGObjectt __gtype__RRRRRRR R R R R RRRRR5(R!ttype_((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR.²s,      !     cCso|j}|dk r|S|ttttttgkr;dS|tkrKdS|t ksc|t krgdSdSdS(NiR%g( R/R,RRRRR R RR R(R!R1tptype((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR0Ës   cCst|j}|j}|tkrF|ttfkrFtd|fƒ‚n*|tkrp|dk rptdƒ‚qpndS(Ns%default must be True or False, not %rs)object types does not have default values(R/R1RtTruetFalseR5RR,(R!RSR1((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR2Ús    cCsx|j}|tttgkr"dS|tkr3t S|tkrDt S|tkrTt S|t krdt S|t krtdSdS(Niii>iI@IÀIÿÿÿÿÿÿÿ¿(R/RRR R RRRRRRRR R,(R!RS((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR9äs      cCs|j}|tkrtS|tkr)tS|tkr9dS|tkrIdS|tkrYtS|t krit S|t kryt S|t kr‰tSdS( Nii>ii?I@Iÿÿÿÿÿÿÿ?llÿÿÿÿ(R/RRRRR R R RRRRRRRR,(R!RS((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR;ös$         cCst|d|j|ƒdS(Nt_property_helper_(tsetattrR=(R!RCRE((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR)scCst|d|j|jƒS(NRV(tgetattrR=R1(R!RC((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR(scCs)td|jt|ƒjfƒ|_dS(Ns%s property of %s is read-only(R5R=R/R#R>(R!RCRE((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR&scCs)td|jt|ƒjfƒ|_dS(Ns%s property of %s is write-only(R5R=R/R#R>(R!RC((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR'sc CsÒ|j}|ttttttttgkrN|j ƒ|j ƒ|j f}n`|t ksf|t kru|j f}n9|tkrŠd}n$|jtƒr¢d}n t|ƒ‚|j|j|jf||jfS(N(((R/RRRRR R R RR9R;R1RRRtis_aRtNotImplementedErrorR6R7R8(R!RStargs((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pytget_pspec_args!s !    N(R#R$t__doc__R/R R,R@tPARAM_READWRITER?R"RGRIR.R0R2R9R;R)R(R&R'R\(((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR.s$  I         (ii(.tsystgobject._gobjecttgobjecttmodulesR@tgobject.constantsRRRRRRRRRR R R R R RRRRRRRRRRRRRRRRRt version_infoRNR4RKRJt basestringtlongR-R(((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyts   ˆF