ó
&ŠNc           @@  sy  d  d l  m Z d  d l Z d d l m Z m Z y d j Z Wn! e k
 rb d  d l m Z n Xd  d l	 Z	 d d l
 m Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d	 l m Z m Z m Z e j  ƒ  Z! d
 „  Z" d „  Z# d e$ f d „  ƒ  YZ% d e$ f d „  ƒ  YZ& d e& f d „  ƒ  YZ' d e& f d „  ƒ  YZ( d S(   i    (   t   absolute_importNi   (   t   _glibt   _gobjectt    (   t	   maketrans(   t   registry(   t
   Repositoryt   FunctionInfot   RegisteredTypeInfot   EnumInfot
   ObjectInfot   InterfaceInfot   ConstantInfot
   StructInfot	   UnionInfot   Structt   Boxedt   enum_addt   enum_register_new_gtype_and_addt	   flags_addt    flags_register_new_gtype_and_add(   t   GObjectMetat
   StructMetat   Functionc         C@  s   |  j  ƒ  } | s t S| j ƒ  } | j ƒ  } | d k rF | d k sR | d k rY t j St d | d | g ƒ} t | | ƒ S(   Nt   GObjectt   Objectt   InitiallyUnowneds   gi.repository.%st   fromlist(   t
   get_parentt   objectt   get_namespacet   get_nameR   R   t
   __import__t   getattr(   t   object_infot   parent_object_infot	   namespacet   namet   module(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   get_parent_for_object;   s    $c         C@  sh   g  } x[ |  j  ƒ  D]M } | j ƒ  } | j ƒ  } t d | d | g ƒ} | j t | | ƒ ƒ q W| S(   Ns   gi.repository.%sR   (   t   get_interfacesR   R   R    t   appendR!   (   R"   t
   interfacest   interface_infoR$   R%   R&   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   get_interfaces_for_objectL   s    t   IntrospectionModulec           B@  s/   e  Z d d  „ Z d „  Z d „  Z d „  Z RS(   c         C@  s…   t  j | | ƒ | |  _ | |  _ d | |  _ t  j |  j |  j ƒ t  j |  j ƒ |  _ |  j d  k r t  j |  j ƒ |  _ n  d  S(   Ns   gi.repository.(	   t
   repositoryt   requiret
   _namespacet   _versiont   __name__t   get_typelib_patht   __path__t   Nonet   get_version(   t   selfR$   t   version(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   __init__Y   s    		c         @  sµ  t  j |  j | ƒ } | s7 t d |  j | f ƒ ‚ n  t | t ƒ rŽ| j ƒ  } | j } | d  k rp| j
 ƒ  r¸ | j t j ƒ r” t | ƒ } qú | t j k s© t ‚ t | ƒ } nB | j t j ƒ rÙ t | ƒ } n! | t j k sî t ‚ t | ƒ } | | _ d | j ƒ  | _ t d d ƒ } xH | j ƒ  D]7 } | j ƒ  j | ƒ } t | | | | j ƒ  ƒ ƒ q2Wn  | t j k r¤| | _ q¤nt | t ƒ r\| j ƒ  } | t j k rá| j } | d  k	 rá| |  j | <| Sn  t | t  ƒ r4t! | ƒ ‰  t" ‡  f d †  t# | ƒ Dƒ ƒ }	 ˆ  f |	 }
 t$ } nÊ t | t% ƒ rXt j& f }
 t$ } n¦ t | t' t( f ƒ rò| j t j) ƒ r‹t* f }
 n^ | j t j+ ƒ s»| t j k s»| j, | k rÇt- f }
 n" t. d | j ƒ  | j ƒ  f ƒ ‚ t/ } n t0 | ƒ ‚ | j ƒ  } i | d 6d |  j d 6| d	 6} | | |
 | ƒ } | t j k r¤| | _ q¤nH t | t1 ƒ rzt2 | ƒ } n* t | t3 ƒ r˜| j ƒ  } n t0 | ƒ ‚ | |  j | <| S(
   Ns   %r object has no attribute %rs   gi.repository.t   abcdefgjhijklmnopqrstuvwxyzt   ABCDEFGJHIJKLMNOPQRSTUVWXYZc         3@  s$   |  ] } t  ˆ  | ƒ s | Vq d  S(   N(   t
   issubclass(   t   .0t	   interface(   t   parent(    s-   /usr/lib/python2.7/dist-packages/gi/module.pys	   <genexpr>š   s    s$   unable to create a wrapper for %s.%st   __info__t
   __module__t	   __gtype__(4   R.   t   find_by_nameR0   t   AttributeErrorR2   t
   isinstanceR	   t
   get_g_typet   pytypeR5   t   is_flagst   is_aR   t
   TYPE_FLAGSR   t	   TYPE_NONEt   AssertionErrorR   t	   TYPE_ENUMR   R   R@   R   RA   R   t
   get_valuesR   t	   translatet   setattrt	   get_valueR   t   __dict__R
   R'   t   tupleR,   R   R   t
   GInterfaceR   R   t
   TYPE_BOXEDR   t   TYPE_POINTERt   fundamentalR   t	   TypeErrorR   t   NotImplementedErrorR   R   R   (   R7   R%   t   infot   g_typet   wrappert   ascii_upper_transt
   value_infot
   value_namet   type_R*   t   basest	   metaclasst   dict_(    (   R?   s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   __getattr__e   s†    			#	"		"	
c         C@  s#   t  j |  j ƒ } d |  j | f S(   Ns    <IntrospectionModule %r from %r>(   R.   R3   R0   (   R7   t   path(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   __repr__Ä   s    c         C@  s^   t  t |  j ƒ ƒ } | j |  j j ƒ  ƒ t j |  j ƒ } | j d „  | Dƒ ƒ t	 | ƒ S(   Nc         s@  s   |  ] } | j  ƒ  Vq d  S(   N(   R   (   R=   RZ   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pys	   <genexpr>Ð   s    (
   t   sett   dirt	   __class__t   updateRR   t   keysR.   t	   get_infosR0   t   list(   R7   t   resultt   namespace_infos(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   __dir__È   s
    N(   R2   RA   R5   R9   Rd   Rf   Rp   (    (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR-   W   s   	_	t   DynamicModulec           B@  s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C@  s(   | |  _  d  |  _ d  |  _ d  |  _ d  S(   N(   R0   R5   t   _introspection_modulet   _overrides_moduleR4   (   R7   R$   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR9   Õ   s    			c         C@  sp   t  j |  j ƒ } t |  j | ƒ |  _ t d d |  j g ƒ} t | |  j d  ƒ |  _ t	 j
 |  j ƒ |  _ d  S(   Ns   gi.overridesR   (   t   git   get_required_versionR0   R-   Rr   R    R!   R5   Rs   R.   R3   R4   (   R7   R8   t   overrides_modules(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   _loadÛ   s    	c         C@  s}   |  j  d  k	 rF t |  j  d d ƒ } | | k rm t |  j  | d  ƒ Sn' d |  j | f } | t k rm t | St |  j | ƒ S(   Nt   __all__s   %s.%s(    (   Rs   R5   R!   R0   R   Rr   (   R7   R%   t   override_exportst   key(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRd   ä   s    c         C@  sm   t  t |  j ƒ ƒ } | j |  j j ƒ  ƒ | j t |  j ƒ ƒ t |  j d d ƒ } | j | ƒ t	 | ƒ S(   NRx   (    (
   Rg   Rh   Ri   Rj   RR   Rk   Rr   R!   Rs   Rm   (   R7   Rn   Ry   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRp   õ   s    c         C@  s5   t  j |  j ƒ } d |  j j |  j j |  j | f S(   Ns   <%s.%s %r from %r>(   R.   R3   R0   Ri   RA   R2   (   R7   Re   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRf   ÿ   s
    	(   R2   RA   R9   Rw   Rd   Rp   Rf   (    (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRq   Ô   s
   					
t   DynamicGObjectModulec           B@  s    e  Z d  Z d „  Z d „  Z RS(   sg  Wrapper for the internal GObject module

    This class allows us to access both the static internal PyGObject module and the GI GObject module
    through the same interface.  It is returned when by importing GObject from the gi repository:

    from gi.repository import GObject

    We use this because some PyGI interfaces generated from the GIR require GObject types not wrapped
    by the static bindings.  This also allows access to module attributes in a way that is more
    familiar to GI application developers.  Take signal flags as an example.  The G_SIGNAL_RUN_FIRST
    flag would be accessed as GObject.SIGNAL_RUN_FIRST in the static bindings but in the dynamic bindings
    can be accessed as GObject.SignalFlags.RUN_FIRST.  The latter follows a GI naming convention which
    would be familiar to GI application developers in a number of languages.
    c         C@  s   t  j |  d d ƒd  S(   NR$   R   (   Rq   R9   (   R7   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR9     s    c         C@  sM   d d l  m } t | | d  ƒ } | d  k rI t t |  ƒ j | ƒ } n  | S(   Ni   (   R   (   R   R   R!   R5   t   superR{   Rd   (   R7   R%   R   t   attr(    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRd     s
    (   R2   RA   t   __doc__R9   Rd   (    (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR{     s   	t   DynamicGLibModulec           B@  s    e  Z d  Z d „  Z d „  Z RS(   sý  Wrapper for the internal GLib module

    This class allows us to access both the static internal PyGLib module and the GI GLib module
    through the same interface.  It is returned when by importing GLib from the gi repository:

    from gi.repository import GLib

    We use this because some PyGI interfaces generated from the GIR require GLib types not wrapped
    by the static bindings.  This also allows access to module attributes in a way that is more
    familiar to GI application developers.
    c         C@  s   t  j |  d d ƒd  S(   NR$   t   GLib(   Rq   R9   (   R7   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR9   3  s    c         C@  s=   t  t | d  ƒ } | d  k r9 t t |  ƒ j | ƒ } n  | S(   N(   R!   R   R5   R|   R   Rd   (   R7   R%   R}   (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyRd   6  s    (   R2   RA   R~   R9   Rd   (    (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyR   &  s   	()   t
   __future__R    t   osR   R   R   R   RD   t   stringRt   t	   overridesR   t   _giR   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   t   typesR   R   R   t   get_defaultR.   R'   R,   R   R-   Rq   R{   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/gi/module.pyt   <module>   s"   d		}2 