3 ‰å<_Q(ã @sddlmZddlZddlZddlmZejddkZy djZWn e k r`ddl mZYnXddl Z ddl m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZdd lm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&m'Z'e j(ƒZ)iZ*d d „Z+d d„Z,Gdd„de-ƒZ.dd„Z/dS)é)Úabsolute_importN)ÚLockéÚ)Ú maketransé)Ú RepositoryÚ FunctionInfoÚRegisteredTypeInfoÚEnumInfoÚ ObjectInfoÚ InterfaceInfoÚ ConstantInfoÚ StructInfoÚ UnionInfoÚ CallbackInfoÚStructÚBoxedÚ CCallbackÚenum_addÚenum_register_new_gtype_and_addÚ flags_addÚ flags_register_new_gtype_and_addÚ GInterface)Ú GObjectMetaÚ StructMeta)Ú TYPE_NONEÚ TYPE_BOXEDÚ TYPE_POINTERÚ TYPE_ENUMÚ TYPE_FLAGScCsP|jƒ}|s(|jƒ}|r$|jr$|jStS|jƒ}|jƒ}tjd|ƒ}t||ƒS)Nzgi.repository.) Z get_parentÚ get_g_typeÚpytypeÚobjectÚ get_namespaceÚget_nameÚ importlibÚ import_moduleÚgetattr)Ú object_infoZparent_object_infoZgtypeÚ namespaceÚnameÚmodule©r-ú/usr/lib64/python3.6/module.pyÚget_parent_for_objectLs r/cCsHg}x>|jƒD]2}|jƒ}|jƒ}tjd|ƒ}|jt||ƒƒqW|S)Nzgi.repository.)Zget_interfacesr$r%r&r'Úappendr()r)Ú interfacesZinterface_infor*r+r,r-r-r.Úget_interfaces_for_objectcsr2c@s2eZdZdZd dd„Zdd„Zdd„Zd d „ZdS) ÚIntrospectionModuleaUAn object which wraps an introspection typelib. This wrapping creates a python module like representation of the typelib using gi repository as a foundation. Accessing attributes of the module will dynamically pull them in and create wrappers for the members. These members are then cached on this introspection module. NcCsltj||ƒ||_||_d||_tj|jƒ}|g|_trH|jdƒg|_|jdkr`tj |jƒ|_t ƒ|_ dS)z"Might raise gi._gi.RepositoryErrorzgi.repository.zUTF-8N) Ú repositoryZrequireÚ _namespaceZ_versionÚ__name__Úget_typelib_pathÚ__path__Ú _have_py3ÚdecodeZ get_versionrÚ_lock)Úselfr*ÚversionÚpathr-r-r.Ú__init__vs    zIntrospectionModule.__init__c sÊtj|j|ƒ}|s$td|j|fƒ‚t|tƒ�r"|jƒ}|j�Ú|j }|dk�r|j ƒrv|j t ƒrlt |ƒ}q’t|ƒ}n|j tƒrŠt|ƒ}nt|ƒ}||_d|jƒ|_tddƒ}x2|jƒD]&}|jƒj|ƒ}t||||jƒƒƒqºWx|jƒD]}t||j|ƒqîW|tk�r||_ WdQRX�nšt|tƒ�rŒ|jƒ}t|tƒ�rtt|ƒ‰t ‡fdd„t!|ƒDƒƒ} ˆf| } t"} n¤t|t#ƒ�rŒt$f} t"} nŒt|t%ƒ�r¤t&f} t"} ntt|t't(fƒ�r|j t)ƒ�rÈt*f} nB|j t+ƒ�sê|tk�sê|j,|k�ròt-f} nt.d|jƒ|j/ƒfƒ‚t0} nt1|ƒ‚|j�f|tk�rR|j } | dk �rR| | k�rR| |j2|<| S|d|j|dœ} | || | ƒ}|tk�r€||_ WdQRXn0t|t3ƒ�rž|}nt|t4ƒ�r´|jƒ}nt1|ƒ‚||j2|<|S) Nz%r object has no attribute %rzgi.repository.ZabcdefgjhijklmnopqrstuvwxyzZABCDEFGJHIJKLMNOPQRSTUVWXYZc3s|]}tˆ|ƒs|VqdS)N)Ú issubclass)Ú.0Z interface)Úparentr-r.ú ºsz2IntrospectionModule.__getattr__..z$unable to create a wrapper for %s.%s)Ú__info__Ú __module__Z __gtype__)5r4Z find_by_namer5ÚAttributeErrorr6Ú isinstancer r!r;r"Zis_flagsZis_ar rrrrrrDr$rErZ get_valuesZget_name_unescapedÚ translateÚsetattrZ get_valueZ get_methodsrr r r/Útupler2rrrr rrrrrrZ fundamentalrÚ TypeErrorr%rÚNotImplementedErrorÚ__dict__r r)r<r+ÚinfoZg_typeÚwrapperZascii_upper_transZ value_infoZ value_nameZ method_infor1ÚbasesÚ metaclassZtype_Zdict_r-)rBr.Ú __getattr__‰sŒ                         zIntrospectionModule.__getattr__cCs(tj|jƒ}tr|jdƒ}d|j|fS)NzUTF-8z )r4r7r5r9r:)r<r>r-r-r.Ú__repr__õs  zIntrospectionModule.__repr__cCsFtt|jƒƒ}|j|jjƒƒtj|jƒ}|jdd„|Dƒƒt |ƒS)Ncss |]}t|tƒs|jƒVqdS)N)rGrr%)rArNr-r-r.rCsz.IntrospectionModule.__dir__..) ÚsetÚdirÚ __class__ÚupdaterMÚkeysr4Z get_infosr5Úlist)r<ÚresultZnamespace_infosr-r-r.Ú__dir__üs  zIntrospectionModule.__dir__)N)r6rEÚ __qualname__Ú__doc__r?rRrSr[r-r-r-r.r3ns  lr3cCs0|tkrt|Stj|ƒ}t||ƒ}|t|<|S)z€ :Returns: An object directly wrapping the gi module without overrides. Might raise gi._gi.RepositoryError )Ú_introspection_modulesÚgiZget_required_versionr3)r*r=r,r-r-r.Úget_introspection_module s   r`)0Z __future__rÚsysr&Z threadingrÚ version_infor9rrFÚstringr_Z_girr r r r r rrrrrrrrrrrrÚtypesrrZ _constantsrrrrr Z get_defaultr4r^r/r2r#r3r`r-r-r-r.Ús&   P