ó
#ŠNc           @   sü   d  d l  m Z d  d l m Z d d l m Z d d l Z e d j Z g  Z	 d e j
 f d „  ƒ  YZ
 e e
 ƒ Z
 e	 j d ƒ d	 e j f d
 „  ƒ  YZ e e ƒ Z e	 j d	 ƒ d d d „  ƒ  YZ d e j f d „  ƒ  YZ e e ƒ Z e	 j d ƒ d S(   i   (   t   override(   t   modulesiÿÿÿÿ(   t   GLibNt   Giot   FileEnumeratorc           B   s    e  Z d  „  Z d „  Z e Z RS(   c         C   s   |  S(   N(    (   t   self(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __iter__!   s    c         C   s)   |  j  d  ƒ } | d  k	 r | St ‚ d  S(   N(   t	   next_filet   Nonet   StopIteration(   R   t	   file_info(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __next__$   s    (   t   __name__t
   __module__R   R   t   next(    (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR       s   			t   Settingsc           B   sY   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z e Z d „  Z	 d „  Z
 d „  Z RS(	   s0   Provide dictionary-like access to GLib.Settings.c         C   s&   t  j j |  d | d | d | ƒd  S(   Nt   schemat   backendt   path(   R   R   t   __init__(   R   R   R   R   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR   6   s    c         C   s   | |  j  ƒ  k S(   N(   t	   list_keys(   R   t   key(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __contains__9   s    c         C   s   t  |  j ƒ  ƒ S(   N(   t   lenR   (   R   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __len__<   s    c         C   s   t  S(   N(   t   True(   R   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __bool__?   s    c         C   s5   | |  k r" t  d | f ƒ ‚ n  |  j | ƒ j ƒ  S(   Ns   unknown key: %r(   t   KeyErrort	   get_valuet   unpack(   R   R   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __getitem__G   s    c         C   sÎ   | |  k r" t  d | f ƒ ‚ n  |  j | ƒ } | j d ƒ j ƒ  } | j d ƒ } | d k r˜ | j d ƒ j ƒ  } | j d ƒ s‹ t ‚ | d } n t d t | ƒ ƒ ‚ |  j	 | t
 j | | ƒ ƒ d  S(   Ns   unknown key: %ri    i   t   typet   as&   Cannot handle allowed type range class(   R   t	   get_ranget   get_child_valuet
   get_stringt   get_type_stringt
   startswitht   AssertionErrort   NotImplementedErrort   strt	   set_valueR   t   Variant(   R   R   t   valuet   ranget   type_t   vt   type_str(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __setitem__N   s    c         C   s
   |  j  ƒ  S(   N(   R   (   R   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   keysa   s    N(   R   R   t   __doc__R   R   R   R   R   t   __nonzero__R   R0   R1   (    (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR   3   s   					t   _DBusProxyMethodCallc           B   s8   e  Z d  Z d „  Z d „  Z d „  Z e d „  ƒ Z RS(   s1   Helper class to implement DBusProxy method calls.c         C   s   | |  _  | |  _ d  S(   N(   t
   dbus_proxyt   method_name(   R   R5   R6   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR   j   s    	c   
      C   s“   | \ } } } y | j  | ƒ } WnQ t k
 ru t j ƒ  d  \ } }	 | ra | | |	 | ƒ n | | |	 | ƒ d  SX| | |  j | ƒ | ƒ d  S(   Ni   (   t   call_finisht	   Exceptiont   syst   exc_infot   _unpack_result(
   R   t   objt   resultt	   user_datat   result_callbackt   error_callbackt   real_user_datat   rett   etypet   e(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __async_result_handlern   s    c         O   s  | r? | d } | d } t  | t ƒ sE t d | ƒ ‚ qE n d } t j | t | ƒ ƒ } d | k rÑ | d | j d ƒ | j d ƒ f } |  j j |  j	 | | j d d ƒ | j d	 d
 ƒ d  |  j | ƒ nF |  j j |  j	 | | j d d ƒ | j d	 d
 ƒ d  ƒ } |  j | ƒ Sd  S(   Ni    i   s6   first argument must be the method signature string: %rs   ()t   result_handlert   error_handlerR>   t   flagst   timeoutiÿÿÿÿ(   t
   isinstanceR(   t	   TypeErrorR   R*   t   tuplet   getR5   t   callR6   R   t*   _DBusProxyMethodCall__async_result_handlert	   call_syncR;   (   R   t   argst   kwargst	   signaturet   arg_variantR>   R=   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __call__}   s     

!'c         C   sJ   | j  ƒ  } t | ƒ d k r+ | d } n t | ƒ d k rF d } n  | S(   s?   Convert a D-BUS return variant into an appropriate return valuei   i    N(   R   R   R   (   t   klassR=   (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR;   —   s    	(   R   R   R2   R   RO   RU   t   classmethodR;   (    (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyR4   g   s
   			t	   DBusProxyc           B   s   e  Z d  Z d „  Z RS(   s,  Provide comfortable and pythonic method calls.
    
    This marshalls the method arguments into a GVariant, invokes the
    call_sync() method on the DBusProxy object, and unmarshalls the result
    GVariant back into a Python tuple.

    The first argument always needs to be the D-Bus signature tuple of the
    method call. Example:

      proxy = Gio.DBusProxy.new_sync(...)
      result = proxy.MyMethod('(is)', 42, 'hello')

    The exception are methods which take no arguments, like
    proxy.MyMethod('()'). For these you can omit the signature and just write
    proxy.MyMethod().

    Optional keyword arguments:

    - timeout: timeout for the call in milliseconds (default to D-Bus timeout)

    - flags: Combination of Gio.DBusCallFlags.*

    - result_handler: Do an asynchronous method call and invoke
         result_handler(proxy_object, result, user_data) when it finishes.

    - error_handler: If the asynchronous call raises an exception,
      error_handler(proxy_object, exception, user_data) is called when it
      finishes. If error_handler is not given, result_handler is called with
      the exception object as result instead.
    
    - user_data: Optional user data to pass to result_handler for
      asynchronous calls.

    Example for asynchronous calls:

      def mymethod_done(proxy, result, user_data):
          if isinstance(result, Exception):
              # handle error
          else:
              # do something with result

      proxy.MyMethod('(is)', 42, 'hello',
          result_handler=mymethod_done, user_data='data')
    c         C   s   t  |  | ƒ S(   N(   R4   (   R   t   name(    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   __getattr__Ó   s    (   R   R   R2   RZ   (    (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyRX   ¦   s   ,(    (   t	   overridesR    t   importerR   t   gi.repositoryR   R9   t   _introspection_moduleR   t   __all__R   t   appendR   R4   RX   (    (    (    s4   /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyt   <module>   s   1?0