>–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,fdYZ-dS( iNsgobject._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 BseZdZdefdYZddddddejddd ZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZRS(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__cBseZdZRS(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 |tstdn||_t |tstdn||_|dks|dkr&td|fn||_|dk rr||jkr~td|j |jfq~n |j}||_| dk r| |jkrtd|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 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|jfS(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|dkrtnd|_|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 rt|tjr|jS|ttttttttttttttttttt t t gkr|St!d|fdS(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.pyR0s   cCst|j}|j}|tkrF|ttfkrFtd|fn*|tkrp|dk rptdqpndS(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.pyR2s    cCsx|j}|tttgkr"dS|tkr3t S|tkrDt S|tkrTt S|t krdt S|t krtdSdS(Niii>iI@II(R/RRR R RRRRRRRR R,(R!RS((s</usr/lib64/python2.7/site-packages/gobject/propertyhelper.pyR9s      cCs|j}|tkrtS|tkr)tS|tkr9dS|tkrIdS|tkrYtS|t krit S|t kryt S|t krtSdS( 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|jS(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|tkrd}n$|jtrd}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