fS7TddlmZddlmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZej6Zej8Zej:Zej<Zej>Zej@Z ejBZ!ejDZ"Gdde#Z$dZ%y))_gi) TYPE_NONETYPE_INTERFACE TYPE_CHAR TYPE_UCHAR TYPE_BOOLEANTYPE_INT TYPE_UINT TYPE_LONG TYPE_ULONG TYPE_INT64 TYPE_UINT64 TYPE_ENUM TYPE_FLAGS TYPE_FLOAT TYPE_DOUBLE TYPE_STRING TYPE_POINTER TYPE_BOXED TYPE_PARAM TYPE_OBJECT TYPE_PYOBJECT TYPE_GTYPE TYPE_STRV TYPE_VARIANTc@eZdZdZeeeeee e e e e iZedededee e e eeeeediZeeeeededeee eeeeeiZedededededede dede di ZGdd e Z!d d d d dde"jFd d f d Z$d Z%d Z&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4y )PropertyaCreates 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 lllgceZdZdZy)Property.__metaclass__cy)Nzselfs 4/usr/lib/python3/dist-packages/gi/_propertyhelper.py__repr__zProperty.__metaclass__.__repr__s/N)__name__ __module__ __qualname__r'r#r(r& __metaclass__r!s 0r(r,Nc Hd|_|t}|j||_|j ||_|j t|ts td||_ t|ts td||_ ||_ ||_ |r|s |j}n-|r|s |j}n|s|s|j }|j"}|j%|||_|;||j)kr8td|j|j)fz|j)}||_| ;| |j-kDr8td|j|j-fz|j-} | |_d|_y)Nznick must be a stringzblurb must be a stringz+Minimum for type %s cannot be lower than %dz,Maximum for type %s cannot be higher than %d)nameobject_type_from_pythontype _get_defaultdefault_check_default isinstancestr TypeErrornickblurb__doc__flags_readonly_setter_writeonly_getter_default_getter_default_settergetterfset _get_minimumminimum _get_maximummaximum_exc) r%r@setterr1r3r8r9r;rCrEs r&__init__zProperty.__init__s <D**40 ((1  $$34 4 %%45 5    &**F F++F))F))F F  **,,AYY 1 1 34566'')G  **,,BYY 1 1 34566'')G  r(cXd|jxsdd|jjdS)Nz)r.r1r$s r&r'zProperty.__repr__s' II ** * IINN r(c||Sd|_|j|}|jr|j}d|_||SN)rFfget)r%instanceklassvalueexcs r&__get__zProperty.__get__sC  K  (# 99))CDII r(c|td|_|j|j||jr|j}d|_|yrK)r7rF set_propertyr.)r%rMrOrPs r&__set__zProperty.__set__sI  O dii/ 99))CDII r(c$|j|S)z;Allows application of the getter along with init arguments.)r@r%rLs r&__call__zProperty.__call__s{{4  r(cp|jr"|j|_|j|_||_|S)z8Set the getter function to fget. For use as a decorator.)r:r9rLrVs r&r@zProperty.getters+ <<DJ<t@fvr|StCd|)NzUnsupported type: )"_type_from_pytype_lookupr5r1 issubclassrGObjectGEnumGFlagsGBoxed GInterface __gtype__rrrrr r rr r r rrrrrrrrrrrrr7)r%type_s r&r0zProperty._type_from_pythons D11 1007 7%!$!$!$!$ !12 ?? " y.)ZL)!:{!; !:{K$j)\ KK Le=> >r(cV||S|jj|jdSrK)_default_lookupgetr1)r%r3s r&r2zProperty._get_default s*  N##'' 488r(c|j}|j}|tk(r|dvrtd||tk(r| tdy|t k(r| tdy|j trC| tdtj|j |std|d|y|j tr6tj|j |std|d|y|j tr_|]t|tstd t|z|D]0}t|tt fvstd t|zy|j t"rI|Ft%|d r(tj|j t"std |d|yyy) N)TFz#default must be True or False, not z)object types does not have default valuesz(GType types does not have default valuesz%enum properties needs a default valuez enum value z must be an instance of z flags value zStrv value %s must be a listz'Strv value %s must contain only stringsrbzvariant value )r1r3rr7rris_arrGTyperrr5listreprr6bytesrhasattr)r%ptyper3vals r&r4zProperty._check_defaults ,, \ !wm'C;BDF F m #" KLL# j " JKK# ZZ " GHHYYw',,U3!(%!1224ZZ #99W%**51!(%!1222ZZ "w':gt, >g NOO ^9S%L0#$MPST[P\$\]] ^ZZ %'*=7K0 '8J8O8OP\8]!(%!1229^+> %r(cN|jj|jdSrK)_min_value_lookuprfr1r$s r&rBzProperty._get_minimum3%%))$))T::r(cN|jj|jdSrK)_max_value_lookuprfr1r$s r&rDzProperty._get_maximum6rrr(c8t|d|jz|yN_property_helper_)setattrr.r%rMrOs r&r?zProperty._default_setter=s- 95Ar(cJt|d|jz|jSrv)getattrr.r3r%rMs r&r>zProperty._default_getter@sx!4tyy!@$,,OOr(cjt|jdt|jd|_y)N property of z is read-onlyr7r.r1r)rFrys r&r<zProperty._readonly_setterC& IItH~..01 r(cjt|jdt|jd|_y)Nr~z is write-onlyrr|s r&r=zProperty._writeonly_getterGrr(c r|j}|ttttt t ttfvr$|j|j|jf}n|tk(sH|tk(s?|jts*|jt s|jt"r|jf}nI|t$t&fvrd}n8|jt(s|jt*rd}n t-||j|j.|j0f|z|j2fzS)Nr#)r1r r r r r rrrrCrEr3rrrhrrrrrrrNotImplementedErrorr8r9r;)r%rnargss r&get_pspec_argszProperty.get_pspec_argsOs  Xy)Zj+G G<<t||;D{"e|&;jj#uzz*'=jj&LL?D }j1 1D ZZ $ :(>D%e, , 499djj1D8DJJ=HHr()5r)r*r+r:intr boolrfloatrr6rr/rr[r r rr G_MAXFLOAT G_MAXDOUBLEG_MININTr G_MINLONGr rq G_MAXUINT G_MAXULONGG_MAXINT G_MAXLONGrtrer1r,rPARAM_READWRITErHr'rQrTrWr@rGr0r2r4rBrDr?r>r<r=rr#r(r&rr'sL5n X l { [   1AQZKk\(9H  9JK[J[(9  !11AAQRCS O00#4dD#*=*=t6p  !?(9 2B;;BP11Ir(rcjjdi}g}jjD]\}}t|ts|j s||_|j |vr9||j |j k(rYtd|j z|j ||j <|j||sy|_ djvsdjvrR|D]M}|j|jk7s|j|jk7s6tdjdd}|_fd }|_y) z Scans the given class for instances of Property and merges them into the classes __gproperties__ dict if it exists or adds it if not. __gproperties__z0Property %s was already found in __gproperties__Ndo_get_propertydo_set_propertyzGObject subclass zl defines do_get/set_property and it also uses a property with a custom setter or getter. This is not allowedcT|jjdd}t||dSN-_)r.replacer{)r%pspecr.s r&obj_get_propertyz,install_properties..obj_get_propertys'zz!!#s+tT4((r(c|jjdd}t|d}|r|j||yyr)r.rr{rA)r%rrOr.propclss r&obj_set_propertyz,install_properties..obj_set_propertys=zz!!#s+sD$'  IIdE " r()__dict__rfitemsr5rr.r ValueErrorappendrrLr>rAr?r7r)rr)r gpropertiespropsr.rrrs` r&install_propertiesrbsT ,,""#4b9K Ell((* d dH %99  yyK'tyy)T-@-@-BB !SVZV_V_!_``%)%8%8%:K " LL  %CCLL(,=,M %DyyD000DIIAUAU4U\\$%% %)+C# +Cr(N)&rr _constantsrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrr/rrr#r(r&rs(7777777^^ oo << << MM MM MM ^^ xIvxIv 0+r(