
    giWT                     v	   d dl Z d dlZd dlmZ ddlmZmZ ddlmZm	Z	m
Z
mZmZ ddlmZ ddlmZ d dlmZ d d	lmZ d dlZ ed
      Zg Z G d dej0                        Z ee      Zej3                  d        G d dej4                        Z ee      Zej3                  d       d7dZe G d dej8                               Zej3                  d       e G d dej:                               Zej3                  d       e G d dej<                               Zej3                  d       e G d dej>                               Zej3                  d       e G d dej@                               Z ej3                  d       e G d dejB                               Z!ej3                  d       e G d dejD                               Z"ej3                  d        G d dejF                        Z# ee#      Z#ej3                  d        G d  d!ejH                        Z$ ee$      Z$ej3                  d!        G d" d#ejJ                        Z% ee%      Z%ej3                  d#        G d$ d%      Z& G d& d'ejN                        Z' ee'      Z'ej3                  d'        G d( d)ejP                        Z( ee(      Z(ej3                  d)        G d* d+ejR                        Z) ee)      Z)ej3                  d+        G d, d-ejT                        Z* ee*      Z*ej3                  d-        G d. d/ejV                        Z+ ee+      Z+ej3                  d/       dZ, ee-      5  d d0lm.Z, ddd       e,s ee-      5  d d1lm/Z, ddd       e,r e0       Z1e,jd                   e3ejd                        d  Z4e4jk                         Z6 e7e,      D ]  Z8e8js                  d2      se8ev se8e1v s	 e:ee8      r& e;e,e8      Z<e8Z= e>e<e      r+e<j                         js                  d3e6 d2      re6 d2e8 Z=n.	  e;e<d4      Z@e@j                  js                  d5e4       re4 e8 Z=e<e1e=<    e	ejd                  e=e,jd                   d6e8        ej3                  e=        yy# 1 sw Y   5xY w# 1 sw Y   )xY w# eB$ r Y ^w xY w)8    N)suppress   )register_sigint_fallbackget_event_loop)overridedeprecated_attrdeprecated_initwrap_list_store_equal_funcwrap_list_store_sort_func)CallableInfo)get_introspection_module)PyGIWarning)GLibGioc                       e Zd ZddZy)	ActionMapNc                 x     	 t        |       	 d fd	}|D ]  } ||  	 y# t        $ r t        d      w xY w)a  The ``add_action_entries()`` method is a convenience function for creating
        multiple :class:`~gi.repository.Gio.SimpleAction` instances and adding them
        to a :class:`~gi.repository.Gio.ActionMap`.
        Each action is constructed as per one entry.

        :param list entries:
            List of entry tuples for :meth:`add_action` method. The entry tuple can
            vary in size with the following information:

            * The name of the action. Must be specified.
            * The callback to connect to the "activate" signal of the
              action. Since GLib 2.40, this can be ``None`` for stateful
              actions, in which case the default handler is used. For
              boolean-stated actions with no parameter, this is a toggle.
              For other state types (and parameter type equal to the state
              type) this will be a function that just calls change_state
              (which you should provide).
            * The type of the parameter that must be passed to the activate
              function for this action, given as a single :class:`~gi.repository.GLib.Variant` type
              string (or ``None`` for no parameter)
            * The initial state for this action, given in GLib.Variant text
              format. The state is parsed with no extra type information, so
              type tags must be added to the string if they are necessary.
              Stateless actions should give ``None`` here.
            * The callback to connect to the "change-state" signal of the
              action. All stateful actions should provide a handler here;
              stateless actions should not.

        :param user_data:
            The user data for signal connections, or ``None``
        zentries must be iterableNc                    |rSt         j                  j                  |      sd| d|  d}t        |      t         j                  j	                  |      }nd }|Yt         j
                  j                  d |d d       }t        j                  j                  | ||      }|A|j                  d|
       n-|d|  d| d}t        |      t        j                  | |      }||j                  d	|
       	j                  |       y )
NzThe type string 'z*' given as the parameter type for action 'z'' is not a valid GVariant type string. zchange-statezStateless action 'z,' should give None for 'change_state', not 'z'.)nameparameter_typeactivate)r   VariantTypestring_is_valid	TypeErrornewVariantparser   SimpleActionnew_statefulconnect
ValueError
add_action)r   r   r   statechange_statemsgvariant_parametervariant_stateactionself	user_datas            2/usr/lib/python3/dist-packages/gi/overrides/Gio.py_process_actionz5ActionMap.add_action_entries.<locals>._process_actionR   s    ''77G-n-==ghlgm  nU  VC#C.($($4$4$8$8$H!$(!  $ 2 24d K))66+]  +NN><K  +.tf4`am`nnpqC$S/)))tDU)V#z8Y?OOF#    )NNNN)iterr   )r)   entriesr*   r,   entrys   ` `  r+   add_action_entrieszActionMap.add_action_entries-   sS    @	8M
 PT	$<  	$EU#	$C  	8677	8s   $ 9N)__name__
__module____qualname__r1    r-   r+   r   r   ,   s    E$r-   r   c                   *     e Zd Z fdZd Zd Z xZS )Applicationc                 B    t        |   |i | t               | _        y r2   )super__init__set_asyncio_tasks)r)   argskwargs	__class__s      r+   r;   zApplication.__init__z   s    $)&)!er-   c                 \   t        | j                        5  t        t        j                  j                               j                  | j                        5  t        j                  j                  | g|i |cd d d        cd d d        S # 1 sw Y   nxY wd d d        y # 1 sw Y   y xY wr2   )
r   quitr   r   MainContextdefaultrunningr   r8   run)r)   r>   r?   s      r+   rF   zApplication.run   s    $TYY/	>4++3356>>tyyI	> ??&&t=d=f=		> 	> 	> 	> 	> 	> 	>s$   AB"#B:	B"B	B""B+c                      t        j                  |      } j                           j                  j	                  |        fd}|j                  |       |S )a  Safely create an asyncio task. The application will not quit until the
        task completes. For potentially longer running tasks, you should add
        cancellation logic to abort a task when it is not needed anymore (e.g.
        cancelling it from the Gtk.Window.do_unmap event).

        Note that python will only log a raised exception if the Task is
        destroyed without the result having been collected. However, this does
        also not happen when the task is cancelled. As such, be careful to not
        cancel tasks that are already finished.

        You can deal with this by either only storing a weak reference to the
        Task, by explicitly collecting the result, or by only cancelling it if
        it is not done already.
        c                 \    j                   j                  |        j                          y r2   )r=   discardrelease)taskr)   s    r+   done_cbz0Application.create_asyncio_task.<locals>.done_cb   s     ''-LLNr-   )asynciocreate_taskholdr=   addadd_done_callback)r)   cororK   rL   s   `   r+   create_asyncio_taskzApplication.create_asyncio_task   sN      ""4(		 	%	
 	w'r-   )r3   r4   r5   r;   rF   rS   __classcell__r@   s   @r+   r8   r8   y   s    $
>r-   r8   c                       fd}|S )Nc                 
   t        |   |i | j                  j                  dd      d   dz   j                  z   }r#t        j                  | d dt        d       y t        j                  | dt        d       y )	N.   z) shouldn't be instantiated directly, use z	 instead.r   )
stacklevelz$ shouldn't be instantiated directly.)r:   r;   r4   rsplitr3   warningswarnr   )r)   r>   r?   r   clsinsteads       r+   new_initz_warn_init.<locals>.new_init   s    c4!4262~~$$S!,R036EMM6B7)9U MM&<=r-   r6   )r_   r`   ra   s   `` r+   
_warn_initrb      s      Or-   c                   2    e Zd Z eej
                  d      Zy)VolumeMonitorzGio.VolumeMonitor.get()N)r3   r4   r5   rb   r   rd   r;   r6   r-   r+   rd   rd      s     #++-FGHr-   rd   c                   0    e Zd Z eej
                        Zy)DBusAnnotationInfoN)r3   r4   r5   rb   r   rf   r;   r6   r-   r+   rf   rf      s    #001Hr-   rf   c                   0    e Zd Z eej
                        Zy)DBusArgInfoN)r3   r4   r5   rb   r   rh   r;   r6   r-   r+   rh   rh      s    #//*Hr-   rh   c                   0    e Zd Z eej
                        Zy)DBusMethodInfoN)r3   r4   r5   rb   r   rj   r;   r6   r-   r+   rj   rj          #,,-Hr-   rj   c                   0    e Zd Z eej
                        Zy)DBusSignalInfoN)r3   r4   r5   rb   r   rm   r;   r6   r-   r+   rm   rm      rk   r-   rm   c                   0    e Zd Z eej
                        Zy)DBusInterfaceInfoN)r3   r4   r5   rb   r   ro   r;   r6   r-   r+   ro   ro      s    #//0Hr-   ro   c                   0    e Zd Z eej
                        Zy)DBusNodeInfoN)r3   r4   r5   rb   r   rq   r;   r6   r-   r+   rq   rq      s    #**+Hr-   rq   c                       e Zd Zd Zd Zy)FileEnumeratorc                     | S r2   r6   r)   s    r+   __iter__zFileEnumerator.__iter__       r-   c                 8    | j                  d       }||S t        r2   )	next_fileStopIteration)r)   	file_infos     r+   __next__zFileEnumerator.__next__   s"    NN4(	 r-   Nr3   r4   r5   rv   r|   r6   r-   r+   rs   rs          r-   rs   c                       e Zd Zd Zy)MenuItemc                 f    |D ],  \  }}}| j                  |t        j                  ||             . y r2   )set_attribute_valuer   r   )r)   
attributesr   format_stringvalues        r+   set_attributezMenuItem.set_attribute  s5    *4 	O&D-$$T4<<u+MN	Or-   N)r3   r4   r5   r   r6   r-   r+   r   r     s    Or-   r   c                   v    e Zd ZdZ eej                  j                  d      Zd Zd Z	d Z
d Zd Zd	 Zd
 Zy)Settingsz0Provide dictionary-like access to GLib.Settings.)schemapathbackend)	arg_namesc                 &    || j                         v S r2   	list_keysr)   keys     r+   __contains__zSettings.__contains__  s    dnn&&&r-   c                 4    t        | j                               S r2   )lenr   ru   s    r+   __len__zSettings.__len__  s    4>>#$$r-   c              #   @   K   | j                         E d {    y 7 wr2   r   ru   s    r+   rv   zSettings.__iter__  s     >>###s   c                      y)NTr6   ru   s    r+   __bool__zSettings.__bool__!  s     r-   c                 d    || vrt        d|      | j                  |      j                         S )Nunknown key: )KeyError	get_valueunpackr   s     r+   __getitem__zSettings.__getitem__&  s3    d?]3'233~~c"))++r-   c           	         || vrt        d|      | j                  |      }|j                  d      j                         }|j                  d      }|dk(  r9|j                  d      j	                         }|j                  d      sJ |dd  }n|dk(  r|j                  d      j	                         j                  d      sJ |j                  d      j                  d      j	                         }|j                         }||vrt        d| d| d	      |d
k(  rb|j                  d      }|j                  d      j	                         }|j                         \  }	}
||	k  s||
kD  r,t        d| d|	 d|
 d	      t        dt        |      z         | j                  |t        j                  ||             y )Nr   r   rY   typeaenumzvalue z is not an allowed enum ()rangez not in range (z - z'Cannot handle allowed type range class )r   	get_rangeget_child_value
get_stringget_type_string
startswithr   r!   NotImplementedErrorstr	set_valuer   r   )r)   r   r   r   type_vtype_strallowedtuple_min_max_s              r+   __setitem__zSettings.__setitem__-  s   d?]3'233 s#%%a(335!!!$F?((+;;=H&&s+++|Hf_$$Q'779DDSIII((+;;A>NNPHhhjGG# 6%0I'RS!TUUg&&q)F--a0@@BHJD$t|ut| 6%vSa!PQQ%9CJF  	sDLL59:r-   c                 "    | j                         S r2   r   ru   s    r+   keyszSettings.keysO  s    ~~r-   N)r3   r4   r5   __doc__r	   r   r   r;   r   r   rv   r   r   r   r   r6   r-   r+   r   r     sC    :)FH'%$
, ;D r-   r   c                   @    e Zd ZdZd Zd ZdddddddZed	        Zy)
_DBusProxyMethodCallz1Helper class to implement DBusProxy method calls.c                      || _         || _        y r2   )
dbus_proxymethod_name)r)   r   r   s      r+   r;   z_DBusProxyMethodCall.__init__Z  s    $&r-   c                     |\  }}}	 |j                  |      } ||| j	                  |      |       y # t        $ r5 t        j                         d d \  }}	|r |||	|       Y y  |||	|       Y y w xY w)Nr   )call_finish	Exceptionsysexc_info_unpack_result)
r)   objresultr*   result_callbackerror_callbackreal_user_dataret_etypees
             r+   __async_result_handlerz+_DBusProxyMethodCall.__async_result_handler^  s    <E9..		//&)C 	T005~F  	r*IFAsA~6   Q7	s   3 /A1$
A10A1Nr   rZ   )result_handlererror_handlerr*   flagstimeoutc          	         |r(|d   }|dd  }t        |t              st        d|      d}t        j                  |t        |            }|;|||f}| j                  j                  | j                  |||d | j                  |       y | j                  j                  | j                  |||d       }	| j                  |	      S )Nr   rY   z4first argument must be the method signature string: z())
isinstancer   r   r   r   tupler   callr   *_DBusProxyMethodCall__async_result_handler	call_syncr   )
r)   r   r   r*   r   r   r>   	signaturearg_variantr   s
             r+   __call__z_DBusProxyMethodCall.__call__m  s     QI8Di-J9-X  Ill9eDk:%'	BIOO    ++ 	 __..  +ugtF &&v..r-   c                 p    |j                         }t        |      dk(  r|d   }|S t        |      dk(  rd}|S )z@Convert a D-BUS return variant into an appropriate return value.rY   r   N)r   r   )klassr   s     r+   r   z#_DBusProxyMethodCall._unpack_result  sE      v;!AYF  [AFr-   )	r3   r4   r5   r   r;   r   r   classmethodr   r6   r-   r+   r   r   W  s;    ;'G$ )V  r-   r   c                       e Zd ZdZd Zy)	DBusProxya$  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                 F    |j                  d      r| |   S t        | |      S )Ndo_)r   r   )r)   r   s     r+   __getattr__zDBusProxy.__getattr__  s%    ??5!:#D$//r-   N)r3   r4   r5   r   r   r6   r-   r+   r   r     s    +Z0r-   r   c                   $    e Zd Zd Zd Zd Zd Zy)	ListModelc                 D   t        |t              r=t        |j                  t	        |              D cg c]  }| j                  |       c}S t        |t              r9|dk  r|t	        |       z  }|dk  rt        | j                  |      }|t        |S t        c c}w Nr   )	r   slicer   indicesr   get_itemint
IndexErrorr   )r)   r   ir   s       r+   r   zListModel.__getitem__  s    c5!.3S[[T5K.LMDMM!$MMc3Qws4y Qw  --$C{  J Ns   Bc                     | j                         j                  }t        |      s%t        d|j                   d|j
                         t        fd| D              S )NExpected type rX   c              3   (   K   | ]	  }|k(    y wr2   r6   ).0r   items     r+   	<genexpr>z)ListModel.__contains__.<locals>.<genexpr>  s     +19+s   )get_item_typepytyper   r   r4   r3   any)r)   r   r   s    ` r+   r   zListModel.__contains__  sV    ##%,,$'nV->->,?q@QRSS+d+++r-   c                 "    | j                         S r2   )get_n_itemsru   s    r+   r   zListModel.__len__  s    !!r-   c              #   d   K   t        t        |             D ]  }| j                  |        y wr2   )r   r   r   )r)   r   s     r+   rv   zListModel.__iter__  s-     s4y! 	#A--""	#s   .0N)r3   r4   r5   r   r   r   rv   r6   r-   r+   r   r     s    ,"#r-   r   c                   :     e Zd Z fdZ fdZd Zd Zd Z xZS )	ListStorec                 :    t        |      }t        |   |g| S r2   )r   r:   sort)r)   compare_funcr*   r@   s      r+   r   zListStore.sort  s!    0>w|L5955r-   c                 <    t        |      }t        |   ||g| S r2   )r   r:   insert_sorted)r)   r   r   r*   r@   s       r+   r   zListStore.insert_sorted  s$    0>w$T<D)DDr-   c                    t        |t              r|j                  t        |             \  }}}|dk(  r!| j	                  |t        ||z
  d      g        y |dk(  r$| j	                  |dz   t        ||z
  d      g        y t        t        |||      d      D ]  }| j                  |        y t        |t              r>|dk  r|t        |       z  }|dk  s|t        |       k\  rt        | j                  |       y t        )NrY   r   rZ   T)reverse)r   r   r   r   splicemaxsortedr   remover   r   r   )r)   r   startstopstepr   s         r+   __delitem__zListStore.__delitem__	  s    c5! #CI 6E4qyE3te|Q#7<D1Hc%$,&:B?eT4 8$G #AKKN#S!Qws4y Qw#T*  KKOr-   c                    t        |t              r4| j                         j                  }g }|D ]D  }t        ||      s%t	        d|j
                   d|j                         |j                  |       F |j                  t        |             \  }}}|dk(  r!| j                  |t        ||z
  d      |       y t        t        |||            }	t        |	      t        |      k7  rt        |dk(  r*| j                  |dz   t        ||z
  d      |d d d          y t        |	|      D ]  \  }
}| j                  |
d|g        y t        |t               r|dk  r|t        |       z  }|dk  s|t        |       k\  rt"        | j                         j                  }t        ||      s%t	        d|j
                   d|j                         | j                  |d|g       y t        )Nr   rX   rY   r   rZ   )r   r   r   r   r   r4   r3   appendr   r   r   r  listr   r!   zipr   r   )r)   r   r   r   	valuelistr   r  r  r  r   r   s              r+   r   zListStore.__setitem__  s   c5!'')00FI $!!V,#():):(;1V__<MN    #$ !$CI 6E4qyE3te|Q#7CuUD$78w<3y>1$$2:KKq#edlA*>	$B$P #GY 7 /1Aq1#./S!Qws4y Qw#T*  '')00FeV,.1B1B0C1V__DU VWWKKQ(Or-   c                 @    t        |      } | j                  ||g| S r2   )r
   find_with_equal_func_full)r)   r   
equal_funcr*   s       r+   find_with_equal_funczListStore.find_with_equal_funcB  s(     0
;
-t--dJKKKr-   )	r3   r4   r5   r   r   r  r   r  rT   rU   s   @r+   r   r      s    6E&$LLr-   r   c                       e Zd Zd Zd Zy)DataInputStreamc                     | S r2   r6   ru   s    r+   rv   zDataInputStream.__iter__O  rw   r-   c                 >    | j                  d       d   }||S t        r   )read_line_utf8rz   )r)   lines     r+   r|   zDataInputStream.__next__R  s(    ""4(+Kr-   Nr}   r6   r-   r+   r  r  N  r~   r-   r  c                       e Zd Zd Zy)Filec                 J    | j                         }||dk(  rt        d      |S )N zFile has no associated path.)	peek_pathr   )r)   r   s     r+   
__fspath__zFile.__fspath___  s,    ~~ <42::;;r-   N)r3   r4   r5   r  r6   r-   r+   r  r  ^  s    r-   r  )GioUnix)GioWin32_g_	__gtype__GrX   r2   )CrM   r]   
contextlibr   _ossighelperr   r   	overridesr   r   r	   r
   r   _gir   moduler   gir   gi.repositoryr   r   r   __all__r   r	  r8   rb   rd   rf   rh   rj   rm   ro   rq   rs   r   r   r   r   r   r   r  r  GioPlatformImportErrorr  r  globalsgio_globals
_namespacer   platform_namelowerplatform_name_lowerdirattrr   hasattrgetattroriginal_attrwrapper_attrr   
get_symbolgtyper   AttributeErrorr6   r-   r+   <module>r<     s  $    C   -   
u%
F$ F$R Y	 { *#// *Z {# } ( 
HC%% H 
H
   
2// 2 
2 # $ 
+#// + 
+ }  
.S'' . 
.    
.S'' . 
.    
1-- 1 
1 " # 
,3## , 
, ~ 	S'' 	 .)   Os|| O H z ? s|| ? D H z M M`10 10h Y	 { # #: Y	 { GL GLT Y	 { 	c)) 	 ?+   !388  ~ v  k 545 	+	 :9: )K"--c#...A.CDEM'--/K  %OOC w{"sD!T2<
&&(33b9L8MQ4OP12!D6:L{;::((1]O)<=&3_TF#;L %2L!NNL[-C-C,DAdV*L	
 	|$9% 5 5: :> " s*   R5R#,-R0R #R-0R87R8