Zc@seddlZddlZddlZejjZddlmZmZm Z m Z m Z m 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.fdYZ/dZ0dS( iNi(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_PYOBJECTt TYPE_GTYPEt TYPE_STRVt TYPE_VARIANTiitPropertyc BseZdZiee6ee6ee6e e 6e e 6e e6Zide6de6de6e e6e e 6ee6ee6de6Ziee6ee6de6d e6ee6ee 6ee6ee6Zi de6de6de6de6de6de6de 6de6de 6Zde fd YZ!d!d!d!d!dde#j$d!d!d Z%d Z&d Z'd Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5RS("sCreates 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__cBseZdZRS(cCsdS(Ns((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.pyRsc Csd|_|dkrt}n|j||_|j||_|jt|t sjt dn||_ t|t st dn||_ ||_ ||_|r| r|j}n<|r| r|j}n#| r| r|j}|j}n|j|||_|dk rZ||jkrft d|j|jfqfn |j}||_| dk r| |jkrt d|j|jfqn |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|jfS(Nss(uninitialized)(R t_gobjectt type_nameR#(R((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyRs cCsx|dkr|Sd|_y|j|}Wn!tk rOtjd}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|dkrtnd|_|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|tr]t|tjtjtjtjtj fr]|j S|t t t ttttttttttttttttttt fkr|St!d|fdS(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|jdS(N(Rt_default_lookuptgetR#(RR%((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR$'s cCs!|j}|j}|tkrF|ttfkrFtd|fn|tkrp|dk rtdqn|tkr|dk rtdqnt j |t r|dkrtdqt j ||std||fqn(t j |t r5t j ||std||fqnt j |t r|dk rt|ts{tdt|nx|D]7}t|ttfkrtdt|qqWn]t j |tr|dk rt|d  st j |t rtd ||fqndS( 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_aR R RR'tlisttreprtstrtbytesRthasattr(RtptypeR%tval((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR&,s>         #cCs|jj|jdS(N(t_min_value_lookupRSR#R(R((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyR4MscCs|jj|jdS(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|jS(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 |j f}n|t ks|t ks|jts|jts|jtr|j f}nN|ttfkrd}n3|jts|jtrd}n t||j|j|jf||jfS(N(((R#RRRRR R R RR5R7R%RRtis_aR R RRRRRtNotImplementedErrorR*R+R-(RR\targs((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytget_pspec_argsis    llllllN(6RRR,Rt_longRtintRtboolRtfloatRRYRR!RIRRR t G_MAXFLOATR t G_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      !      csvjjdi}g}xjjD]\}}t|tr+|js[||_n|j|kr||j|jkrq+ntd|jn|j||j<|j|q+q+W|sdS|_ djksdjkrHxN|D]C}|j |j ks(|j |j krtdjfqqWnd}|_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||dS(Nt-t_(R treplaceRbR(RtpspecR ((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytobj_get_propertyscsD|jjdd}t|d}|r@|j||ndS(NRwRx(R RyRbRR3(RRzRCR tprop(tcls(s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytobj_set_propertys(t__dict__RStitemsR'RR Rft ValueErrortappendRtR=R0R3R1R)RRuRv(R}t gpropertiestpropsR R|R{R~((R}s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pytinstall_properties|s2    $  (1tsysR?tgi._gitgit_giR;t _constantsRRRRRRRRRR R R R R RRRRRRRRRRRkRlRmRqRoRnRrRpt version_infoRYR(RhRgt basestringtlongR!RR(((s8/usr/lib64/python2.7/site-packages/gi/_propertyhelper.pyts(             J