
    gi,                        d dl Z d dlZd dlmZmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZmZmZmZ ddlmZ d dlmZmZ  ed	      Zej,                  d
k(  Zej,                  dk(  Zg Ze	Z	ej5                  d       e
Z
ej5                  d        G d de      Zej5                  d       erd Zej5                  d       d Z G d d      Z G d dej>                        Z ee      Zej5                  d       er0 G d dej@                  e      Z  ee       Z ej5                  d       ne!Z  G d dejD                        Z" ee"      Z"ej5                  d       er G d dejF                        Z# ee#      Z#ej5                  d        G d dejH                        Z$ ee$      Z$ej5                  d        G d d ejJ                        Z% ee%      Z%ej5                  d         G d! d"ejL                        Z& ee&      Z&ej5                  d"        G d# d$ejN                  e       Z' ee'      Z'ej5                  d$       er. G d% d&ejP                        Z( ee(      Z(ej5                  d&       er. G d' d(ejR                        Z) ee)      Z)ej5                  d(       er. G d) d*ejT                        Z* ee*      Z*ej5                  d*       d+ Z+ G d, d-ejX                        Z, ee,      Z,ej5                  d-       erejZ                  j\                  Z/n  eejZ                  j\                  d.ed/0      Z/ G d1 d2ejZ                        Z- ee-      Z-ej5                  d2        G d3 d4ej`                  e       Z0 ee0      Z0ej5                  d4       er/ G d5 d6ejb                  e0      Z1 ee1      Z1ej5                  d6       er\ G d7 d8ejd                        Z2 ee2      Z2ej5                  d8        G d9 d:ejf                        Z3 ee3      Z3ej5                  d:       er. G d; d<ejh                        Z4 ee4      Z4ej5                  d<       er. G d= d>ejj                        Z5 ee5      Z5ej5                  d>        G d? d@ejl                        Z6 ee6      Z6ej5                  d@       er. G dA dBejn                        Z7 ee7      Z7ej5                  dB        G dC dDejp                        Z8 ee8      Z8ej5                  dD        G dE dFejr                        Z9 ee9      Z9ej5                  dF        G dG dHejt                        Z: ee:      Z:ej5                  dH        G dI dJejv                        Z; ee;      Z;ej5                  dJ        G dK dLejx                        Z< ee<      Z<ej5                  dL        G dM dNejz                        Z= ee=      Z=ej5                  dN       er. G dO dPej|                        Z> ee>      Z>ej5                  dP        G dQ dRej~                  e<e=      Z? ee?      Z?ej5                  dR        G dS dT      Z@ej5                  dT        G dU dV      ZAej5                  dV        G dW dXej                        ZB eeB      ZBej5                  dX        G dY dZej                  e<e=      ZC eeC      ZCej5                  dZ        G d[ d\ej                  e       ZD eeD      ZDej5                  d\        G d] d^ej                        ZE eeE      ZEej5                  d^        G d_ d`ej                        ZF eeF      ZFej5                  d`       er G da dbej                  e       ZG eeG      ZGej5                  db        G dc ddej                        ZH eeH      ZHej5                  dd        G de dfej                        ZI eeI      ZIej5                  df        G dg dhej                        ZJ eeJ      ZJej5                  dh       er] G di djej                  e       ZK eeK      ZKej5                  dj        G dk dlej                        ZL eeL      ZLej5                  dl       er\ G dm dnej                        ZM eeM      ZMej5                  dn        G do dpej                        ZN eeN      ZNej5                  dp       er. G dq drej                        ZO eeO      ZOej5                  dr       er G ds dtej                        ZP eeP      ZPej5                  dt        G du dvej                        ZQ eeQ      ZQej5                  dv        G dw dxej                        ZR eeR      ZRej5                  dx        G dy dzej                        ZS eeS      ZSej5                  dz       eser. G d{ d|ej                        ZT eeT      ZTej5                  d|       er. G d} d~ej                        ZU eeU      ZUej5                  d~       er. G d dej                        ZV eeV      ZVej5                  d       erej                  ZX eej                        d        ZWej                  ZZ eej                        d        ZYej                  Z\ej                  Z^ eej                        d        Z[ eej                        d        Z]er# eej                        Z_ej5                  d        ed      sdZ`yerej                         Z`yej                  e j                        \  Z`Zb eceb      e _b        y)    N)GObjectGLib   )register_sigint_fallbackget_event_loop)Template_extract_handler_and_args)overridestrip_boolean_resultdeprecated_initwrap_list_store_sort_func)get_introspection_module)PyGIDeprecationWarning
get_optionGtkz3.0z4.0r   r	   c                       e Zd Zy)PyGTKDeprecationWarningN)__name__
__module____qualname__     2/usr/lib/python3/dist-packages/gi/overrides/Gtk.pyr   r   2   s    r   r   c                     g }| D ]I  }t        |t        j                        st        j                  j                  | }|j	                  |       K |S )zCreate a list of TargetEntry items from a list of tuples in the form (target, flags, info).

        The list can also contain existing TargetEntry items in which case the existing entry
        is re-used in the return list.
        )
isinstancer   TargetEntrynewappend)targetstarget_entriesentrys      r   _construct_target_listr"   ;   sP      	)EeS__5++U3!!%(	) r   r"   c                    t        ||      \  }}|t        j                  j                  z  }	|.|	r |j                  |||g|  y  |j
                  |||g|  y |	r |j                  ||g|  y  |j                  ||g|  y N)r	   r   ConnectFlagsAFTERconnect_object_afterconnect_objectconnect_afterconnect)
buildergobjsignal_namehandler_nameconnect_objflags
obj_or_maphandlerargsafters
             r   _builder_connect_callbackr5   K   s     .j,GMGTG((...E%D%%k7KO$ODWkIDID{G;d;DLLg55r   c                       e Zd Zd Zd Zd Zy)_FreezeNotifyManagerc                     || _         y r$   )obj)selfr9   s     r   __init__z_FreezeNotifyManager.__init__^   s	    r   c                      y r$   r   r:   s    r   	__enter__z_FreezeNotifyManager.__enter__a   s    r   c                 8    | j                   j                          y r$   )r9   thaw_child_notify)r:   exc_type	exc_value	tracebacks       r   __exit__z_FreezeNotifyManager.__exit__d   s    ""$r   N)r   r   r   r;   r>   rD   r   r   r   r7   r7   ]   s    %r   r7   c                        e Zd Z eej
                  j                        Zerd Zd Z	e
r fdZe
r fdZe
r fdZe
rddZ xZS  xZS )Widgetc                     |t        |       v S r$   )listr:   childs     r   __contains__zWidget.__contains__m   s    DJ&&r   c              #   `   K   | j                         }|r| |j                         }|ry y wr$   )get_first_childget_next_siblingrI   s     r   __iter__zWidget.__iter__p   s/     ((*E..0 s   )..c                 6    t         |           t        |       S r$   )superfreeze_child_notifyr7   )r:   	__class__s    r   rR   zWidget.freeze_child_notifyx   s    G')'--r   c                     |Bt        |t        j                        s(t        j                  j                  t	        |            }t
        |   |       y r$   )r   r   
TargetListr   r"   rQ   drag_dest_set_target_listr:   target_listrS   s     r   rV   z Widget.drag_dest_set_target_list~   s>    '{CNN;!nn001G1TUG-k:r   c                     |Bt        |t        j                        s(t        j                  j                  t	        |            }t
        |   |       y r$   )r   r   rU   r   r"   rQ   drag_source_set_target_listrW   s     r   rZ   z"Widget.drag_source_set_target_list   s>    '{CNN;!nn001G1TUG/<r   c                     |D| j                  |      }|t        d|  d| d      t        j                  |j                        }t
        j                  j                  | ||       |j                         S )NClass "z#" does not contain style property "")	find_style_property
ValueErrorr   Value
value_typer   rF   style_get_property	get_value)r:   property_namevalueprops       r   rb   zWidget.style_get_property   st    }//><$!$'J=/YZ[   doo6JJ))$uE??$$r   r$   )r   r   r   r   r   rF   translate_coordinatesGTK4rK   rO   GTK3rR   rV   rZ   rb   __classcell__rS   s   @r   rF   rF   h   sR    01Q1QR	'	1 	. 	; 	= 
	% r   rF   c                   p    e Zd Zd Zd Zd Zd Zd	dZd Zd Z	 e
ej                  j                        Zy)
	Containerc                 4    t        | j                               S r$   )lenget_childrenr=   s    r   __len__zContainer.__len__   s    t((*++r   c                 &    || j                         v S r$   )rp   rI   s     r   rK   zContainer.__contains__   s    D--///r   c                 4    t        | j                               S r$   )iterrp   r=   s    r   rO   zContainer.__iter__   s    ))+,,r   c                      yNTr   r=   s    r   __bool__zContainer.__bool__   s    r   Nc                     |D| j                  |      }|t        d|  d| d      t        j                  |j                        }t
        j                  j                  | |||       |j                         S )Nr\   z#" does not contain child property "r]   )	find_child_propertyr_   r   r`   ra   r   rm   child_get_propertyrc   )r:   rJ   rd   re   rf   s        r   rz   zContainer.child_get_property   sv    }//><$!$'J=/YZ[   doo6MM,,T5-O??$$r   c                 L    |D cg c]  }| j                  ||       c}S c c}w )z<Returns a list of child property values for the given names.)rz   )r:   rJ   
prop_namesnames       r   	child_getzContainer.child_get   s#    EOPTD++E48PPPs   !c                 ~    |j                         D ]*  \  }}|j                  dd      }| j                  |||       , y)z=Set a child properties on the given child to key/value pairs._-N)itemsreplacechild_set_property)r:   rJ   kwargsr}   re   s        r   	child_setzContainer.child_set   s=    %||~ <e||C-''tU;<r   r$   )r   r   r   rq   rK   rO   rw   rz   r~   r   r   r   rm   get_focus_chainr   r   r   rm   rm      s<    	,	0	-	
	%	Q	< /s}}/L/LMr   rm   c                   Z     e Zd Z fdZ eej                  j                  d      Z xZS )Editablec                 &    t         |   |d|      S N)rQ   insert_text)r:   textpositionrS   s      r   r   zEditable.insert_text   s    w"4X66r   r   fail_ret)	r   r   r   r   r   r   r   get_selection_boundsrj   rk   s   @r   r   r      s$    7 0))Br   r   c                   J    e Zd Z eej
                  j                  de      Zy)Actionr}   labeltooltipstock_id	arg_namescategoryN)r   r   r   r   r   r   r;   r   r   r   r   r   r      s    "JJ>,
r   r   c                   J    e Zd Z eej
                  j                  de      Zy)RadioActionr}   r   r   r   re   r   N)r   r   r   r   r   r   r;   r   r   r   r   r   r      s    "OO$$G,
r   r   c                   d    e Zd Z eej
                  j                  de      ZddZddZ		 ddZ
y)	ActionGroup)r}   r   Nc                      	 t        |       	 	 	 	 	 d fd	}|D ]  } ||  	 y# t        $ r t        d      w xY w)a  The add_actions() method is a convenience method that creates a number
            of gtk.Action  objects based on the information in the list of action
            entry tuples contained in entries and adds them to the action group.
            The entry tuples can vary in size from one to six items with the
            following information:

                * The name of the action. Must be specified.
                * The stock id for the action. Optional with a default value of None
                  if a label is specified.
                * The label for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None if a stock id is specified.
                * The accelerator for the action, in the format understood by the
                  gtk.accelerator_parse() function. Optional with a default value of
                  None.
                * The tooltip for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None.
                * The callback function invoked when the action is activated.
                  Optional with a default value of None.

            The "activate" signals of the actions are connected to the callbacks and
            their accel paths are set to <Actions>/group-name/action-name.
            entries must be iterableNc                     t        | |||      }|(|j                  d|       n|j                  d|       j                  ||       y Nr   activate)r   r*   add_action_with_accel)	r}   r   r   acceleratorr   callbackactionr:   	user_datas	          r   _process_actionz0ActionGroup.add_actions.<locals>._process_action  sT      UGh ' (z8<z8YG**6;?r   )NNNNNrt   	TypeErrorr:   entriesr   r   es   ` `  r   add_actionszActionGroup.add_actions   s\    2<W  @&  $#$-  < :;;<s   ( =c                      	 t        |       	 	 	 	 	 	 d fd	}|D ]  } ||  	 y# t        $ r t        d      w xY w)au  The add_toggle_actions() method is a convenience method that creates a
            number of gtk.ToggleAction objects based on the information in the list
            of action entry tuples contained in entries and adds them to the action
            group. The toggle action entry tuples can vary in size from one to seven
            items with the following information:

                * The name of the action. Must be specified.
                * The stock id for the action. Optional with a default value of None
                  if a label is specified.
                * The label for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None if a stock id is specified.
                * The accelerator for the action, in the format understood by the
                  gtk.accelerator_parse() function. Optional with a default value of
                  None.
                * The tooltip for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None.
                * The callback function invoked when the action is activated.
                  Optional with a default value of None.
                * A flag indicating whether the toggle action is active. Optional
                  with a default value of False.

            The "activate" signals of the actions are connected to the callbacks and
            their accel paths are set to <Actions>/group-name/action-name.
            r   Nc                     t         j                  | |||      }|j                  |       |(	|j                  d|       n|j                  d|	       j	                  ||       y r   )r   ToggleAction
set_activer*   r   )
r}   r   r   r   r   r   	is_activer   r:   r   s
           r   r   z7ActionGroup.add_toggle_actions.<locals>._process_actionM  sm     ))UGh *  !!),' (z8<z8YG**6;?r   )NNNNNFr   r   s   ` `  r   add_toggle_actionszActionGroup.add_toggle_actions-  s_    6<W  @*  $#$1  < :;;<s   ) >c                      	 t        |       d}	 	 	 	 	 d fd	}|D ]  } ||g| }||} |,|)||j                  d|       y|j                  d||       yyy# t        $ r t        d      w xY w)a  The add_radio_actions() method is a convenience method that creates a
            number of gtk.RadioAction objects based on the information in the list
            of action entry tuples contained in entries and adds them to the action
            group. The entry tuples can vary in size from one to six items with the
            following information:

                * The name of the action. Must be specified.
                * The stock id for the action. Optional with a default value of None
                  if a label is specified.
                * The label for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None if a stock id is specified.
                * The accelerator for the action, in the format understood by the
                  gtk.accelerator_parse() function. Optional with a default value of
                  None.
                * The tooltip for the action. This field should typically be marked
                  for translation, see the set_translation_domain() method. Optional
                  with a default value of None.
                * The value to set on the radio action. Optional with a default
                  value of 0. Should be specified in applications.

            The value parameter specifies the radio action that should be set
            active. The "changed" signal of the first radio action is connected to
            the on_change callback (if specified and not None) and the accel paths
            of the actions are set to <Actions>/group-name/action-name.
            r   Nc                     t        |||||      }t        r|j                  |        	|k(  r|j                  d       j	                  ||       |S )Nr   T)r   ri   
join_groupr   r   )
group_sourcer}   r   r   r   r   entry_valuer   r:   re   s
           r   r   z6ActionGroup.add_radio_actions.<locals>._process_action  s\     %#%% %%l3K'%%d+**6;?r   changed)NNNNr   )rt   r   r*   )	r:   r   re   	on_changer   first_actionr   r   r   s	   ` `      r   add_radio_actionszActionGroup.add_radio_actionsf  s    :<W  L
  4  *(::'#)L	* 'I,A$ ((I> ((IyI	 -B'K  < :;;<s   A! !A6r$   )NNN)r   r   r   r   r   r   r;   r   r   r   r   r   r   r   r   r      s9    "OO$$,
3	$j7	$t BFH	Jr   r   c                       e Zd Zd ZddZy)	UIManagerc                     t        |t              st        d      t        |      }t        j
                  j                  | ||      S Nzbuffer must be a string)r   strr   _get_utf8_lengthr   r   add_ui_from_stringr:   bufferlengths      r   r   zUIManager.add_ui_from_string  s;    fc* 9::%f-F==33D&&IIr   c                 D    t         j                  j                  | ||      S r$   )r   r   insert_action_groupr   s      r   r   zUIManager.insert_action_group  s    ==44T66JJr   Nr   )r   r   r   r   r   r   r   r   r   r     s    	J	Kr   r   c                   D    e Zd Z eej
                  j                        Zy)ComboBoxN)r   r   r   r   r   r   get_active_iterr   r   r   r   r     s    *3<<+G+GHOr   r   c                   J    e Zd Z eej
                  j                  de      Zy)Box)homogeneousspacingr   N)r   r   r   r   r   r   r;   r   r   r   r   r   r     s    "GG0,
r   r   c                   x    e Zd Z eej
                  j                  ddej                  j                  ie	      Zy)	SizeGroup)moder   )r   deprecated_defaultsr   N)
r   r   r   r   r   r   r;   SizeGroupModeVERTICALr   r   r   r   r   r     s3    "MM""!'):):)C)C D,	
r   r   c                   J    e Zd Z eej
                  j                  de      Zy)MenuItemr   r   N)r   r   r   r   r   r   r;   r   r   r   r   r   r     s    "LL!! ,
r   r   c                 ~    t        | t              sJ t        | t              s| j                  d      } t	        |       S )Nutf-8)r   r   bytesencodero   )strings    r   r   r     s4    fc"""fe$w'v;r   c                   R     e Zd ZerddlmZ  e       Zd fd	Znd Zd Z	d Z
 xZS )Builderr   )define_builder_scopec                 p    t         |           |r%| j                  t        j	                  |             y y r$   )rQ   r;   	set_scoper   BuilderScope)r:   scope_object_or_maprS   s     r   r;   zBuilder.__init__   s.    G"w334GHI #r   c                 0    | j                  t        |       y)a  Connect signals specified by this builder to a name, handler mapping.

            Connect signal, name, and handler sets specified in the builder with
            the given mapping "obj_or_map". The handler/value aspect of the mapping
            can also contain a tuple in the form of (handler [,arg1 [,argN]])
            allowing for extra arguments to be passed to the handler. For example:

            .. code-block:: python

                builder.connect_signals({"on_clicked": (on_clicked, arg1, arg2)})
            N)connect_signals_fullr5   )r:   r1   s     r   connect_signalszBuilder.connect_signals  s     %%&?Lr   c                     t        |t              st        d      t        |      }t        j
                  j                  | ||      S r   )r   r   r   r   r   r   add_from_stringr   s      r   r   zBuilder.add_from_string  s;    &#&566!&){{**4@@r   c                     t        |t              st        d      t        |      }t        j
                  j                  | |||      S r   )r   r   r   r   r   r   add_objects_from_string)r:   r   
object_idsr   s       r   r   zBuilder.add_objects_from_string  s=    &#&566!&){{224TTr   r$   )r   r   r   rh   _gtktemplater   r   r;   r   r   r   rj   rk   s   @r   r   r     s)    7+-	J	MAUr   r   )type   )r   r   
stacklevelc                       e Zd Zd Zy)Windowc                 Z    t         st        d      rt        d      t        | g|i | y )Nlegacy_autoinitzRGtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.)initializedr   RuntimeError_window_initr:   r3   r   s      r   r;   zWindow.__init__9  s4    z*;<H  	T+D+F+r   N)r   r   r   r;   r   r   r   r   r   8  s    ,r   r   c                       e Zd Zer>dZ eej                  j                  ddddde	      Z
d Zd	 Z ed
       Z ed       Zd Zy)Dialog)titleparentr0   buttons_buttons_property)r   transient_forr0   add_buttonsr  )r0   r  r  r  )r  r  )r   ignoredeprecated_aliasesr   c                    |j                         }t        t        | j                  |            }|j	                  |       d}| j
                  t        k7  r,| j
                  j                  t        j                  k7  r|dz  }|j                  d      }|It        |t        j                        s/t        j                  dt        |       |j                  dd        nd }|j                  dd      }|r`t        j                  dt        |       |t        j                   j"                  z  rd	|d
<   |t        j                   j$                  z  rd	|d<    | j&                  |i | |r | j(                  |  y y )Nr      r  zThe "buttons" argument must be a Gtk.ButtonsType enum value. Please use the "add_buttons" method for adding buttons. See: https://wiki.gnome.org/Projects/PyGObject/InitializerDeprecationsr   r0   r   zThe "flags" argument for dialog construction is deprecated. Please use initializer keywords: modal=True and/or destroy_with_parent=True. See: https://wiki.gnome.org/Projects/PyGObject/InitializerDeprecationsTmodaldestroy_with_parent)copydictzip_old_arg_namesupdaterS   r   r;   getr   r   ButtonsTypewarningswarnr   popDialogFlagsMODALDESTROY_WITH_PARENT_initr  )r:   r3   r   
new_kwargs
old_kwargsr   r  r0   s           r   r;   zDialog.__init__T  sH   Jc$"5"5t<=Jf% J~~'DNN,C,Cv,Va

 %..3K&z+s/W] ,) y$/"NN7A.E] ,) 3??000*.Jw'3??>>>8<J45DJJ+
+   +. 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r$   )
r   destroyr   r   MainContextdefaultrunningr   r   runr   s      r   r"  z
Dialog.run  s    (6=t//779:BB4<<P= zz~~d<T<V<	= = = = = = =s$   AB"#B:	B"B	B""B+c                 "    | j                         S r$   )get_action_areadialogs    r   <lambda>zDialog.<lambda>  s    f.D.D.F r   c                 "    | j                         S r$   )get_content_arear%  s    r   r'  zDialog.<lambda>  s    v'>'>'@ r   c                 N    d } ||      D ]  \  }}| j                  ||        y)a  The add_buttons() method adds several buttons to the Gtk.Dialog using
        the button data passed as arguments to the method. This method is the
        same as calling the Gtk.Dialog.add_button() repeatedly. The button data
        pairs - button text (or stock ID) and a response ID integer are passed
        individually. For example:

        .. code-block:: python

            dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE)

        will add "Open" and "Close" buttons to dialog.
        c              3   p   K   | r	 | dd \  }}| dd  } ||f | ry y # t         $ r t        d      w xY ww)Nr   r   z%Must pass an even number of arguments)r_   )btrs      r   _buttonz#Dialog.add_buttons.<locals>._button  sW     NQq6DAq abEd
  " N$%LMMNs   6 6636N)
add_button)r:   r3   r/  r   responses        r   r  zDialog.add_buttons  s.    	 &dm 	,ND(OOD(+	,r   N)r   r   r   ri   r  r   r   r   r;   r   r  r"  propertyaction_areavboxr  r   r   r   r   r   F  s_    UJJS+!).  -	
-	/^	= FG@A,r   r   c                   ^    e Zd Z eej
                  j                  dddde      Zd Zd Z	y)	MessageDialog)r  r0   message_typer  message_formatr8  r   )r   r7  r   r  r   c                 L    | j                  dd       | j                  d|       y )Nsecondary-use-markupFsecondary-textset_propertyr:   r8  s     r   format_secondary_textz#MessageDialog.format_secondary_text  s$    4e<.?r   c                 L    | j                  dd       | j                  d|       y )Nr;  Tr<  r=  r?  s     r   format_secondary_markupz%MessageDialog.format_secondary_markup  s$    4d;.?r   N)
r   r   r   r   r   r6  r;   r   r@  rB  r   r   r   r6  r6    s5    "&&V(8&Q,	
	@	@r   r6  c                   J    e Zd Z eej
                  j                  de      Zy)ColorSelectionDialogr   r   N)r   r   r   r   r   rD  r;   r   r   r   r   rD  rD    s!    "$$-- ,
r   rD  c                   J    e Zd Z eej
                  j                  de      Zy)FileChooserDialog)r   r  r   r  r   N)r   r   r   r   r   rG  r;   r   r   r   r   rG  rG    s!    "!!**>,
r   rG  c                   J    e Zd Z eej
                  j                  de      Zy)FontSelectionDialogrE  r   N)r   r   r   r   r   rI  r;   r   r   r   r   rI  rI    s!    "##,, ,
r   rI  c                   P    e Zd Z eej
                  j                  dddie      Zy)RecentChooserDialog)r   r  recent_managerr  rL  managerr9  N)r   r   r   r   r   rK  r;   r   r   r   r   rK  rK    s+     ###,,F 0)<,	
r   rK  c                       e Zd Zer eej                  j                  de      Z e	ej                  j                        Z
 e	ej                  j                        Z e	ej                  j                        Zy)IconViewmodelr   N)r   r   r   ri   r   r   rO  r;   r   r   get_item_at_posget_visible_rangeget_dest_item_at_posr   r   r   rO  rO    sb    "LL!! ,
 +3<<+G+GHO,S\\-K-KL/0Q0QRr   rO  c                   J    e Zd Z eej
                  j                  de      Zy)
ToolButton)r   r   N)r   r   r   r   r   rV  r;   r   r   r   r   rV  rV  	  s    "NN###,
r   rV  c                   D    e Zd Z eej
                  j                        Zy)	IMContextN)r   r   r   r   r   rX  get_surroundingr   r   r   rX  rX    s    *3==+H+HIOr   rX  c                   D    e Zd Z eej
                  j                        Zy)
RecentInfoN)r   r   r   r   r   r[  get_application_infor   r   r   r[  r[    s    /0S0STr   r[  c                   |    e Zd ZddZddZddZddZd Zd ZddZ	 e
ej                  j                  d	
      Zy)
TextBufferNc                 r    t        j                  dd|i|}| j                         j                  |       |S )a  Creates a tag and adds it to the tag table of the TextBuffer.

        :param str tag_name:
            Name of the new tag, or None
        :param **properties:
            Keyword list of properties and their values

        This is equivalent to creating a Gtk.TextTag and then adding the
        tag to the buffer's tag table. The returned tag is owned by
        the buffer's tag table.

        If ``tag_name`` is None, the tag is anonymous.

        If ``tag_name`` is not None, a tag called ``tag_name`` must not already
        exist in the tag table for this buffer.

        Properties are passed as a keyword list of names and values (e.g.
        foreground='DodgerBlue', weight=Pango.Weight.BOLD)

        :returns:
            A new tag.
        r}   r   )r   TextTagget_tag_tableadd)r:   tag_name
propertiestags       r   
create_tagzTextBuffer.create_tag%  s6    . kk6x6:6  %
r   c                 F    t         j                  j                  | |||      S r$   )r   r^  create_mark)r:   	mark_namewhereleft_gravitys       r   rh  zTextBuffer.create_mark@  s    ~~))$	5,OOr   c                 F    t         j                  j                  | ||       y r$   )r   r^  set_textr:   r   r   s      r   rm  zTextBuffer.set_textC  s    dF3r   c                     t        |t              st        dt        |             t        j
                  j                  | |||       y Nztext must be a string, not )r   r   r   r   r   r^  insert)r:   rt   r   r   s       r   rq  zTextBuffer.insertF  s;    $$9$t*FGGdD$7r   c                     |j                         }| j                  ||       |sy | j                  |      }|D ]  }| j                  |||        y r$   )
get_offsetrq  get_iter_at_offset	apply_tag)r:   rt   r   tagsstart_offsetstartre  s          r   insert_with_tagszTextBuffer.insert_with_tagsL  sQ    (D$''5 	-CNN3t,	-r   c                     g }|D ]B  }| j                         j                  |      }|st        d|       |j                  |       D  | j                  ||g|  y )Nzunknown text tag: )ra  lookupr_   r   ry  )r:   rt   r   rv  tag_objsre  tag_objs          r   insert_with_tags_by_namez#TextBuffer.insert_with_tags_by_nameX  sj     	%C((*11#6G #5cU!;<<OOG$		% 	dD484r   c                     t        |t              st        dt        |             t        j
                  j                  | ||       y rp  )r   r   r   r   r   r^  insert_at_cursorrn  s      r   r  zTextBuffer.insert_at_cursorc  s9    $$9$t*FGG''dF;r   r   r   r$   )Fr   )r   r   r   rf  rh  rm  rq  ry  r~  r  r   r   r^  r   r   r   r   r^  r^  $  sB    6P48
-	5< 0++br   r^  c                   |    e Zd Z eej
                  j                        Z eej
                  j                        Zy)TextIterN)r   r   r   r   r   r  forward_searchbackward_searchr   r   r   r  r  r  s*    )#,,*E*EFN*3<<+G+GHOr   r  c                       e Zd Zd Zd Zd Z fdZd Zd Zd Z	d Z
d	 Z eej                  j                        Z eej                  j                         Z eej                  j"                        Z eej                  j$                        Z eej                  j&                  ed
      Z fdZ fdZ fdZd Zd Zd Zd Z fdZ fdZ fdZ fdZ fdZ  xZ!S )	TreeModelc                 $    | j                  d       S r$   )iter_n_childrenr=   s    r   rq   zTreeModel.__len__|  s    ##D))r   c                      yrv   r   r=   s    r   rw   zTreeModel.__bool__  s    r   c                 .   t        |t        j                        r|S t        |t              r:|dk  r5t	        |       |z   }|dk  rd|d}t        |      | j                  |      S 	 | j                  |      }|S # t        $ r t        d| d      w xY w)Nr   zrow index is out of bounds: dzcould not find tree path '')r   r   TreeIterintro   
IndexErrorget_iterr_   )r:   keyindexmsgaiters        r   _getiterzTreeModel._getiter  s    c3<<(Jc3C!GIOEqy4SG< o%==''	BMM#&E   	B9#a@AA	Bs   (A; ;Bc                 z    t               }t        |d      r|j                         S t        j	                  |       S )Nsort_new_with_model)rQ   hasattrr  TreeModelSortnew_with_model)r:   super_objectrS   s     r   r  zTreeModel.sort_new_with_model  s5    w<!673355++D11r   c                 P    t        |t        j                        r|S t        |      S r$   )r   r   TreePath)r:   paths     r   _coerce_pathzTreeModel._coerce_path  s    dCLL)K~r   c                 <    | j                  |      }t        | |      S r$   )r  TreeModelRowr:   r  r  s      r   __getitem__zTreeModel.__getitem__  s    c"D%((r   c                 F    | |   }| j                  |j                  |       y r$   )set_rowrt   )r:   r  re   rows       r   __setitem__zTreeModel.__setitem__  s    3iSXXu%r   c                 H    | j                  |      }| j                  |       y r$   )r  remover  s      r   __delitem__zTreeModel.__delitem__  s    c"Er   c                 6    t        | | j                               S r$   )TreeModelRowIterget_iter_firstr=   s    r   rO   zTreeModel.__iter__  s    d&9&9&;<<r   zinvalid tree pathc                 p    | j                  |      }t        | 	  |      \  }}|st        d| d      |S )Nzinvalid tree path 'r  )r  rQ   r  r_   )r:   r  successr  rS   s       r   r  zTreeModel.get_iter  sC      &)$/24&:;;r   c                 L    |j                         }t        | 	  |      }|r|S y r$   )r  rQ   	iter_next)r:   r  	next_iterr  rS   s       r   r  zTreeModel.iter_next  s)    JJL	'#I.r   c                 L    |j                         }t        | 	  |      }|r|S y r$   )r  rQ   iter_previous)r:   r  	prev_iterr  rS   s       r   r  zTreeModel.iter_previous  s)    JJL	''	2r   c                 *   t        |t              rt        d      | j                         }t	        |      |k7  rt        d      g }g }t        |      D ]:  \  }}|	|j                  | j                  ||             |j                  |       < ||fS )Nz%Expected a list or tuple, but got strz1row sequence has the incorrect number of elements)	r   r   r   get_n_columnsro   r_   	enumerater   _convert_value)r:   r  	n_columnsresultcolumnscur_colre   s          r   _convert_rowzTreeModel._convert_row  s     c3CDD&&(	s8y PQQ'n 	$NGU}MM$--gu=>NN7#	$   r   c                 f    | j                  |      \  }}|D ]  }| j                  ||||           y r$   )r  	set_value)r:   treeiterr  _converted_rowr  columns         r   r  zTreeModel.set_row  s:    "&"3"3C"8 	:FNN8VS[9	:r   c                     t        |t        j                        r|S t        j                  | j                  |      |      S )z6Convert value to a GObject.Value of the expected type.)r   r   r`   get_column_type)r:   r  re   s      r   r  zTreeModel._convert_value  s1    eW]]+L}}T11&95AAr   c                     | j                         }g }|D ]S  }t        |t              st        d      |dk  s||k\  rt	        d      |j                  | j                  ||             U t        |      S )Nzcolumn numbers must be intsr   zcolumn number is out of range)r  r   r  r   r_   r   rc   tuple)r:   r  r  r  valuescols         r   r  zTreeModel.get  sw    &&(	 	9Cc3' =>>Qw#* !@AAMM$..378	9 V}r   c                 B    t         |   | j                  |      |      S r$   )rQ   row_changedr  r:   r  rt   rS   s      r   r  zTreeModel.row_changed  s     w"4#4#4T#:DAAr   c                 B    t         |   | j                  |      |      S r$   )rQ   row_insertedr  r  s      r   r  zTreeModel.row_inserted  s     w#D$5$5d$;TBBr   c                 B    t         |   | j                  |      |      S r$   )rQ   row_has_child_toggledr  r  s      r   r  zTreeModel.row_has_child_toggled  s     w,T->->t-DdKKr   c                 @    t         |   | j                  |            S r$   )rQ   row_deletedr  r:   r  rS   s     r   r  zTreeModel.row_deleted  s    w"4#4#4T#:;;r   c                 D    t         |   | j                  |      ||      S r$   )rQ   rows_reorderedr  )r:   r  rt   	new_orderrS   s       r   r  zTreeModel.rows_reordered  s"    w%d&7&7&=tYOOr   )"r   r   r   rq   rw   r  r  r  r  r  r  rO   r   r   r  r  iter_childreniter_nth_childiter_parentget_iter_from_stringr_   r  r  r  r  r  r  r  r  r  r  r  r  rj   rk   s   @r   r  r  {  s    *2
)&= *#--*F*FGN()D)DEM)#--*F*FGN&s}}'@'@AK/**J8K!(:
B$BCL<P Pr   r  c                   h     e Zd Z eej
                  j                  d      Zd fd	Zd fd	Z xZ	S )TreeSortable)NNr   c                 (    t         |   |||       y r$   )rQ   set_sort_func)r:   sort_column_id	sort_funcr   rS   s       r   r  zTreeSortable.set_sort_func  s    niCr   c                 &    t         |   ||       y r$   )rQ   set_default_sort_func)r:   r  r   rS   s      r   r  z"TreeSortable.set_default_sort_func  s    %i;r   r$   )
r   r   r   r   r   r  get_sort_column_idr  r  rj   rk   s   @r   r  r    s1     .++lD< <r   r  c                       e Zd Z eej
                  j                  de      Z eej
                  d      s	e	d        Z
yy)r  rP  r   r  c                 ,    t         j                  |      S r$   )r  r  )r:   child_models     r   r  zTreeModelSort.new_with_model*  s     44[AAr   N)r   r   r   r   r   r  r;   r   r  classmethodr  r   r   r   r  r  !  sM    "&& ,
 s((*:;B B <r   r  c                       e Zd Zd Z eej                  d      sej                  j                  Zn) eej                  d      sej                  j                  Zd Z	ddZ
ddZddZdd	Zdd
Zd Zd Zy)	ListStorec                 d    t         j                  j                  |        | j                  |       y r$   )r   r  r;   set_column_typesr:   column_typess     r   r;   zListStore.__init__3  "    t$l+r   insert_with_valuesvinsert_with_valuesc                     |)| j                  |      \  }}| j                  |||      }|S t        j                  j	                  | |      }|S r$   )r  r  r   r  rq  )r:   r   r  r  r  s        r   
_do_insertzListStore._do_insert>  sS    ?,,S1LC..x#FH  }}++D(;Hr   Nc                 h    |r| j                  d|      S t        j                  j                  |       S r   )r  r   r  r   r:   r  s     r   r   zListStore.appendG  s-    ??2s++ }}##D))r   c                 &    | j                  d|      S Nr   r  r  s     r   prependzListStore.prependN  s    q#&&r   c                 &    | j                  ||      S r$   r  )r:   r   r  s      r   rq  zListStore.insertQ  s    x--r   c                     |9|d}n"| j                  |      j                         d   }| j                  ||      S t        j                  j                  | |      S r   )get_pathget_indicesr  r   r  insert_beforer:   siblingr  r   s       r   r  zListStore.insert_beforeT  sU    ?==1==?C??8S11}}**499r   c                     |<|d}n%| j                  |      j                         d   dz   }| j                  ||      S t        j                  j                  | |      S Nr   r   r	  )r  r  r  r   r  insert_afterr  s       r   r  zListStore.insert_after^  sZ    ?==1==?CaG??8S11}}))$88r   c                 l    | j                  ||      }t        j                  j                  | |||       y r$   )r  r   r  r  r:   r  r  re   s       r   r  zListStore.set_valueh  ,    ##FE2h>r   c                 x     fd}|rt        |d   t              r ||d d d   |dd d          y t        |d   t        t        f      r)t	        |      dk7  rt        d       ||d   |d          y t        |d   t              r' |t        |d         |d   j                                y t        d      y )Nc                 X   t        |       t        |      k7  rt        d      g }g }t        | |      D ]R  \  }}t        |t              st        d      |j                  |       |j                  j                  ||             T t        j                  j                  ||       y Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.)
ro   r   r  r   r  r   r  r   r  setcolsvalsr  r  col_numre   r:   r  s         r   
_set_listsz!ListStore.set.<locals>._set_listsm      4yCI%M  GF"%dD/ C!'3/#$VWWw'd11'5ABC MMdHgv>r   r   r   r	  Too many argumentsArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}.  No -1 termination is needed.)r   r  r  rH   ro   r   r  r  r:   r  r3   r  s   ``  r   r	  zListStore.setl  s    	?" $q'3'4!9d14a4j1DGeT]3t9>#$89947DG,DGT*4Q=$q'..*:; b  r   r$   )r   r   r   r;   r  r   r  r  r  r  r   r  rq  r  r  r  r	  r   r   r   r  r  2  so    , 3=="78!mm>>S]]$89 ]]>>*'.:9?r   r  c                   |    e Zd Zd Zed        Zed        Zed        Zed        Zd Z	d Z
d Zd	 Zd
 Zd Zd Zy)r  c                 r   t        |t        j                        s"t        dt	        |      j
                   d      || _        t        |t        j                        r|j                  |      | _	        y t        |t        j                        r|| _	        y t        dt	        |      j
                   d      )Nzexpected Gtk.TreeModel, z foundz'expected Gtk.TreeIter or Gtk.TreePath, )r   r   r  r   r   r   rQ  r  r  rt   r  )r:   rQ  iter_or_paths      r   r;   zTreeModelRow.__init__  s    %/6tE{7K7K6LFSTT
lCLL1|4DIcll3$DI9%../v7 r   c                 L    | j                   j                  | j                        S r$   )rQ  r  rt   r=   s    r   r  zTreeModelRow.path  s    zz""499--r   c                 "    | j                         S r$   )get_nextr=   s    r   nextzTreeModelRow.next  s    }}r   c                 "    | j                         S r$   )get_previousr=   s    r   previouszTreeModelRow.previous  s      ""r   c                 "    | j                         S r$   )
get_parentr=   s    r   r  zTreeModelRow.parent  s      r   c                 ~    | j                   j                  | j                        }|rt        | j                   |      S y r$   )rQ  r  rt   r  )r:   r  s     r   r  zTreeModelRow.get_next  s1    JJ((3	

I66r   c                 ~    | j                   j                  | j                        }|rt        | j                   |      S y r$   )rQ  r  rt   r  )r:   r  s     r   r  zTreeModelRow.get_previous  s1    JJ,,TYY7	

I66r   c                 ~    | j                   j                  | j                        }|rt        | j                   |      S y r$   )rQ  r  rt   r  )r:   parent_iters     r   r  zTreeModelRow.get_parent  s1    jj,,TYY7

K88r   c                    t        |t              rj|| j                  j                         k\  rd|d}t	        |      |dk  r| j                  |      }| j                  j                  | j                  |      S t        |t              rl|j                  | j                  j                               \  }}}t        |||      D cg c](  }| j                  j                  | j                  |      * c}S t        |t              r|D cg c]  }| |   	 c}S t        dt        |      j                         c c}w c c}w )Ncolumn index is out of bounds: r  r   z.indices must be integers, slice or tuple, not )r   r  rQ  r  r  _convert_negative_indexrc   rt   sliceindicesranger  r   r   r   )r:   r  r  rx  stopstepiks           r   r  zTreeModelRow.__getitem__  s   c3djj..007Aw? o%Qw2237::''		377c5! #DJJ,D,D,F GE4<A%t<T78

$$TYY2  c5!%()DG))<T#Y=O=O<PQ
 	
 *s   -D;E c                    t        |t              rl|| j                  j                         k\  rd|d}t	        |      |dk  r| j                  |      }| j                  j                  | j                  ||       y t        |t              r|j                  | j                  j                               \  }}}t        |||      }t        |      t        |      k7  r(dt        |      ddt        |      dd}t        |      t        |      D ]/  \  }}	| j                  j                  | j                  |	||          1 y t        |t              rXt        |      t        |      k7  r'dt        |      ddt        |      d}t        |      t        ||      D ]
  \  }
}	|	| |
<    y t!        dt#        |      j$                         )Nr$  r  r   z#attempt to assign sequence of size z to slice of size z to sequence of size z0indices must be an integer, slice or tuple, not )r   r  rQ  r  r  r%  r  rt   r&  r'  r(  ro   r_   r  r  r  r   r   r   )r:   r  re   r  rx  r)  r*  	indexListr+  vr,  s              r   r  zTreeModelRow.__setitem__  s   c3djj..007Aw? o%Qw2237JJ  C7U# #DJJ,D,D,F GE4eT40I9~U+;CJq>I[\_`i\jkl[mmno o%!), =1

$$TYY58<=U#3x3u:%;CJq>I^_bcf_ghi^jk o%C 1Q B49CUCUBVW r   c                 l    | j                   j                         |z   }|dk  rd|d}t        |      |S )Nr   r$  r  )rQ  r  r  )r:   r  	new_indexr  s       r   r%  z$TreeModelRow._convert_negative_index  s>    JJ,,.6	q=3E!9=CS/!r   c                 x    | j                   j                  | j                        }t        | j                   |      S r$   )rQ  r  rt   r  )r:   
child_iters     r   iterchildrenzTreeModelRow.iterchildren  s+    ZZ--dii8


J77r   N)r   r   r   r;   r2  r  r  r  r  r  r  r  r  r  r%  r4  r   r   r   r  r    sz     . .   # # ! !
&88r   r  c                       e Zd Zd Zd Zd Zy)r  c                      || _         || _        y r$   )rQ  rt   )r:   rQ  r  s      r   r;   zTreeModelRowIter.__init__  s    
	r   c                     | j                   st        t        | j                  | j                         }| j                  j	                  | j                         | _         |S r$   )rt   StopIterationr  rQ  r  r  s     r   __next__zTreeModelRowIter.__next__  sB    yy4::tyy1JJ((3	
r   c                     | S r$   r   r=   s    r   rO   zTreeModelRowIter.__iter__  s    r   N)r   r   r   r;   r9  rO   r   r   r   r  r     s    r   r  c                   b     e Zd ZddZ fdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Z xZS )r  c                 (   t        |t              rt        |      }n(t        |t              sdj                  d |D              }t	        |      dk(  rt        d| d      	 t        j                  |      S # t
        $ r t        d| d      w xY w)N:c              3   2   K   | ]  }t        |        y wr$   )r   ).0vals     r   	<genexpr>z#TreePath.__new__.<locals>.<genexpr>  s     5CH5s   r   zcould not parse subscript 'z' as a tree path)r   r  r   joinro   r   r  new_from_string)clsr  s     r   __new__zTreePath.__new__  s    dC t9DD#&88555Dt9>9$?OPQQ	R++D11 	R9$?OPQQ	Rs   #A8 8Bc                 "    t         |           y r$   rQ   r;   r:   r3   r   rS   s      r   r;   zTreePath.__init__!  s    r   c                 *    | j                         xs dS )N )	to_stringr=   s    r   __str__zTreePath.__str__$  s    ~~%2%r   c                 6    |d uxr | j                  |      dk  S r  comparer:   others     r   __lt__zTreePath.__lt__'  s     D <T\\%%81%<<r   c                 6    |d uxr | j                  |      dk  S r  rN  rP  s     r   __le__zTreePath.__le__*       D =T\\%%8A%==r   c                 6    |d uxr | j                  |      dk(  S r  rN  rP  s     r   __eq__zTreePath.__eq__-  rU  r   c                 6    |d u xs | j                  |      dk7  S r  rN  rP  s     r   __ne__zTreePath.__ne__0      }8U 3q 88r   c                 6    |d u xs | j                  |      dkD  S r  rN  rP  s     r   __gt__zTreePath.__gt__3  s    }7U 3a 77r   c                 6    |d u xs | j                  |      dk\  S r  rN  rP  s     r   __ge__zTreePath.__ge__6  rZ  r   c                 4    t        | j                               S r$   )rt   r  r=   s    r   rO   zTreePath.__iter__9  s    D$$&''r   c                 "    | j                         S r$   )	get_depthr=   s    r   rq   zTreePath.__len__<  s    ~~r   c                 (    | j                         |   S r$   )r  )r:   r  s     r   r  zTreePath.__getitem__?  s    !%((r   )r   )r   r   r   rE  r;   rL  rR  rT  rW  rY  r\  r^  rO   rq   r  rj   rk   s   @r   r  r    s@    R&=>>989( )r   r  c                   L    e Zd Zd Zd ZddZddZddZddZddZ	d	 Z
d
 Zy)	TreeStorec                 d    t         j                  j                  |        | j                  |       y r$   )r   rd  r;   r  r  s     r   r;   zTreeStore.__init__H  r  r   c                     |*| j                  |      \  }}| j                  ||||      }|S t        j                  j	                  | ||      }|S r$   )r  r  r   rd  rq  )r:   r  r   r  r  r  s         r   r  zTreeStore._do_insertL  sW    ?,,S1LC..vx#NH  }}++D&(CHr   Nc                 (    | j                  |d|      S r   r  r:   r  r  s      r   r   zTreeStore.appendU  s    vr3//r   c                 (    | j                  |d|      S r  r  rh  s      r   r  zTreeStore.prependX  s    vq#..r   c                 (    | j                  |||      S r$   r  )r:   r  r   r  s       r   rq  zTreeStore.insert[  s    vx55r   c                     |M|d}n5|| j                  |      }| j                  |      j                         d   }| j                  |||      S t        j
                  j                  | ||      S r   )r  r  r  r  r   rd  r  r:   r  r  r  r   s        r   r  zTreeStore.insert_before^  sn    ?>!--g6F==1==?C??68S99}}**4AAr   c                     |P|d}n8|| j                  |      }| j                  |      j                         d   dz   }| j                  |||      S t        j
                  j                  | ||      S r  )r  r  r  r  r   rd  r  rl  s        r   r  zTreeStore.insert_afterj  ss    ?>!--g6F==1==?CaG??68S99}}))$@@r   c                 l    | j                  ||      }t        j                  j                  | |||       y r$   )r  r   rd  r  r  s       r   r  zTreeStore.set_valuev  r  r   c                      fd}|rt        |d   t              r ||d d d   |dd d          y t        |d   t        t        f      r)t	        |      dk7  rt        d       ||d   |d          y t        |d   t              r, ||d   j                         |d   j                                y t        d      y )Nc                 X   t        |       t        |      k7  rt        d      g }g }t        | |      D ]R  \  }}t        |t              st        d      |j                  |       |j                  j                  ||             T t        j                  j                  ||       y r  )
ro   r   r  r   r  r   r  r   rd  r	  r
  s         r   r  z!TreeStore.set.<locals>._set_lists{  r  r   r   r   r	  r  r  )	r   r  r  rH   ro   r   r  keysr  r  s   ``  r   r	  zTreeStore.setz  s    	?" $q'3'4!9d14a4j1DGeT]3t9>#$89947DG,DGT*47<<>47>>+;< b  r   r$   )r   r   r   r;   r  r   r  rq  r  r  r  r	  r   r   r   rd  rd  G  s1    ,0/6
B
A?r   rd  c                   F    e Zd Zer eej                  j                  de      Z e	ej                  j                        Z
 e	ej                  j                        Z e	ej                  j                        Zer fdZer fdZ	 d	 fd	Zd
 fd	Zd fd	Zd Z xZS )TreeViewrP  r   c                 >    t        |      }t        | 	  |||       y r$   )r"   rQ   enable_model_drag_source)r:   start_button_maskr   actionsr    rS   s        r   ru  z!TreeView.enable_model_drag_source  s     3G<NG,->PWXr   c                 <    t        |      }t        | 	  ||       y r$   )r"   rQ   enable_model_drag_dest)r:   r   rw  r    rS   s       r   ry  zTreeView.enable_model_drag_dest  s    3G<NG*>7Cr   c                 v    t        |t        j                        st        |      }t        |   |||||       y r$   )r   r   r  rQ   scroll_to_cell)r:   r  r  	use_align	row_align	col_alignrS   s         r   r{  zTreeView.scroll_to_cell  s1     $-D>DtVY	9Mr   c                 r    t        |t        j                        st        |      }t        |   |||       y r$   )r   r   r  rQ   
set_cursor)r:   r  r  start_editingrS   s       r   r  zTreeView.set_cursor  s+    $-D>D47r   c                 n    t        |t        j                        st        |      }t        |   ||      S r$   )r   r   r  rQ   get_cell_area)r:   r  r  rS   s      r   r  zTreeView.get_cell_area  s,    $-D>Dw$T622r   c                     t               }|j                  |       |j                  |d       | j                  ||        |j                  |fi | y NF)TreeViewColumn	set_title
pack_startinsert_columnset_attributes)r:   r   r   cellr   r  s         r   insert_column_with_attributesz&TreeView.insert_column_with_attributes  sM    !$&68,d-f-r   )NF        r  r  r$   )r   r   r   ri   r   r   rs  r;   r   r   get_path_at_posrS  get_dest_row_at_posru  ry  r{  r  r  r  rj   rk   s   @r   rs  rs    s    "LL!! ,
 +3<<+G+GHO,S\\-K-KL.s||/O/OP	Y 	D
 LON8
3
.r   rs  c                   f     e Zd ZddZ eej                  j                        Zd fd	Zd Z	 xZ
S )r  c                     t         j                  j                  | |       |r| j                  |d       |j	                         D ]  \  }}| j                  |||        y )NrE  T)r   r  r;   r  r   add_attribute)r:   r   cell_renderer
attributesr}   re   s         r   r;   zTreeViewColumn.__init__  sZ    ##D#6OOM40%++- 	;KD%}dE:	;r   c                 (    t         |   |||       y r$   )rQ   set_cell_data_func)r:   r  func	func_datarS   s       r   r  z!TreeViewColumn.set_cell_data_func  s    "=$	Br   c                     t         j                  j                  | |       |j                         D ]'  \  }}t         j                  j	                  | |||       ) y r$   )r   
CellLayoutclear_attributesr   r  )r:   r  r  r}   re   s        r   r  zTreeViewColumn.set_attributes  sL    ''m<%++- 	KKD%NN((}dEJ	Kr   )rJ  Nr$   )r   r   r   r;   r   r   r  cell_get_positionr  r  rj   rk   s   @r   r  r    s-    ; -S-?-?-Q-QRCKr   r  c                   2     e Zd Z fdZ fdZ fdZ xZS )TreeSelectionc                 n    t        |t        j                        st        |      }t        |   |       y r$   )r   r   r  rQ   select_pathr  s     r   r  zTreeSelection.select_path  s'    $-D>DD!r   c                 <    t         |          \  }}}|r||fS |d fS r$   )rQ   get_selected)r:   r  rQ  r  rS   s       r   r  zTreeSelection.get_selected  s.     % 4 65>!t}r   c                 .    t         |          \  }}||fS r$   )rQ   get_selected_rows)r:   rowsrQ  rS   s      r   r  zTreeSelection.get_selected_rows  s    g/1et}r   )r   r   r   r  r  r  rj   rk   s   @r   r  r    s    "
 r   r  c                       e Zd Z eej
                  j                  dded      Zd Z e	ej                  d      rd Z e	ej                  d      rd	 Zy
y
)Button)r   stock	use_stockuse_underline)r  r   )r   r  r   r   c                    |j                  d      rbt        j                  dt        d       |j	                         }|d   |d<   d|d<   d|d<   |d= t        j                  j                  | fi | y  | j                  |i | y )	Nr  zKStock items are deprecated. Please use: Gtk.Button.new_with_mnemonic(label)r   r
  r   Tr  r  )	r  r  r  r   r  r   r  r;   r  )r:   r3   r   r  s       r   r;   zButton.__init__  s    
 zz'"F+ 	 $[[]
&0&9
7#*.
;'.2
?+w'

##D7J7

D+F+r   set_focus_on_clickc                 H    t        j                  j                  | g|i |S r$   )r   rF   r  r   s      r   r  zButton.set_focus_on_click&  #     zz44TKDKFKKr   get_focus_on_clickc                 H    t        j                  j                  | g|i |S r$   )r   rF   r  r   s      r   r  zButton.get_focus_on_click-  r  r   N)r   r   r   r   r   r  r;   r   r  r  rF   r  r  r   r   r   r  r    s]    JJF,
	,* 3::34L
 3::34L 5r   r  c                   J    e Zd Z eej
                  j                  de      Zy)
LinkButton)urir   r   N)r   r   r   r   r   r  r;   r   r   r   r   r  r  5  s    "NN##&,
r   r  c                   J    e Zd Z eej
                  j                  de      Zy)Labelr   r   N)r   r   r   r   r   r  r;   r   r   r   r   r  r  ?  s    "II*?V
r   r  c                   ^    e Zd Zer$ eej                  j                  dddded      Z	d Zy)	
Adjustment)re   lowerupperstep_incrementpage_increment	page_size	page_incr	step_incr)r  r  r   )r   r  r   r   c                 &   t         rO | j                  |i | d|v r| j                  |d          y t        |      dk\  r| j                  |d          y y t	        j
                  j                  | g|i | d|v r| j                  |d          y y )Nre   r	  r   )ri   r  r  ro   r   r  r;   r   s      r   r;   zAdjustment.__init__\  s    DJJ'' & vg/TatAw'   NN##D:4:6:
 & vg/ !r   N)
r   r   r   ri   r   r   r  r;   r   r  r   r   r   r  r  H  s;    NN## #."-  -
$0r   r  c                      e Zd Z eej
                  j                  dddde      Zej                  j                  ej                  j                  z  ej                  j                  ej                  j                  z  ddfdZy)	Table)n_rowsr  r   r  r  )r  r  r9  r   c
                 T    t         j                  j                  | |||||||||	
       y r$   )r   r  attach)
r:   rJ   left_attachright_attach
top_attachbottom_attachxoptionsyoptionsxpaddingypaddings
             r   r  zTable.attach~  s4     IIr   N)r   r   r   r   r   r  r;   r   AttachOptionsEXPANDFILLr  r   r   r   r  r  v  st    "II<*0yI,	
 &&--0A0A0F0FF&&--0A0A0F0FF	r   r  c                   J    e Zd Z eej
                  j                  de      Zy)ScrolledWindowhadjustmentvadjustmentr   N)r   r   r   r   r   r  r;   r   r   r   r   r  r    s!    "''4,
r   r  c                   J    e Zd Z eej
                  j                  de      Zy)
HScrollbar
adjustmentr   N)r   r   r   r   r   r  r;   r   r   r   r   r  r        "NN##%,
r   r  c                   J    e Zd Z eej
                  j                  de      Zy)
VScrollbarr  r   N)r   r   r   r   r   r  r;   r   r   r   r   r  r    r  r   r  c                   ,     e Zd Zd fd	Zd fd	Z xZS )Panedc                 (    t         |   |||       y r$   )rQ   pack1r:   rJ   resizeshrinkrS   s       r   r  zPaned.pack1      GM%0r   c                 (    t         |   |||       y r$   )rQ   pack2r  s       r   r  zPaned.pack2  r  r   )FT)TT)r   r   r   r  r  rj   rk   s   @r   r  r    s    	1	1 	1r   r  c                   J    e Zd Z eej
                  j                  de      Zy)Arrow)
arrow_typeshadow_typer   N)r   r   r   r   r   r  r;   r   r   r   r   r  r    s    "II3,
r   r  c                   &     e Zd ZddZ fdZ xZS )IconSetc                     |=t        j                  dt        d       t        j                  j                  |      }|S t        j                  j                  |       }|S )NzXGtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf)r   r
  )r  r  r   r   r  new_from_pixbufrE  )rD  pixbuficonsets      r   rE  zIconSet.__new__  sW    !:+ 	 ++55f= N ++--c2Nr   c                      t         |          S r$   rG  rH  s      r   r;   zIconSet.__init__  s    7#%%r   r$   )r   r   r   rE  r;   rj   rk   s   @r   r  r    s    		& 	&r   r  c                   J    e Zd Z eej
                  j                  de      Zy)Viewportr  r   N)r   r   r   r   r   r  r;   r   r   r   r   r  r    s    "LL!!4,
r   r  c                   &     e Zd Zd fd	Zd Z xZS )TreeModelFilterc                 &    t         |   ||       y r$   )rQ   set_visible_func)r:   r  datarS   s      r   r  z TreeModelFilter.set_visible_func  s     t,r   c                 h    | j                  |      }| j                         j                  |||       y r$   )convert_iter_to_child_iter	get_modelr  )r:   rt   r  re   s       r   r  zTreeModelFilter.set_value  s+    ..t4""47r   r$   )r   r   r   r  r  rj   rk   s   @r   r  r    s    -8r   r  c                         e Zd Zd fd	Z xZS )CssProviderc                     t         j                         t         j                         fdk\  r2t        |t              r|j                  d      }t        |   ||       y t        |t              r|j                  d      }t        |   |       y )N)   	   r   )
r   get_major_versionget_minor_versionr   r   decoderQ   load_from_datar   r   )r:   r   r   rS   s      r   r  zCssProvider.load_from_data  sn    %%')>)>)@AVKdE*;;w/D&tV4dC(;;w/D&t,r   r   )r   r   r   r  rj   rk   s   @r   r  r    s    	- 	-r   r  c                   2     e Zd Zedd       Zd fd	Z xZS )CustomSorterc                 b    |t        |      }nd }t        j                  j                  ||      S r$   )r   r   r  r   )rD  r  r   compare_funcs       r   r   zCustomSorter.new  s0    $8C###''i@@r   c                 D    |t        |      }nd }t        | 	  ||      S r$   )r   rQ   r  )r:   r  r   r  rS   s       r   r  zCustomSorter.set_sort_func  s*    $8C#7(yAAr   r$   )r   r   r   r  r   r  rj   rk   s   @r   r  r    s#    		A 
	A	B 	Br   r  c                       e Zd Zd Zy)Menuc           	      2    | j                  d ||||||       y r$   )popup_for_device)r:   parent_menu_shellparent_menu_itemr  r  buttonactivate_times          r   popupz
Menu.popup,  s'     !!! r   N)r   r   r   r  r   r   r   r
  r
  +  s    	r   r
  c                      t                y r$   )_Gtk_main_quit)r3   s    r   	main_quitr  ?  s    r   c                  <   t        t        j                        5  t        t        j
                  j                               j                  t        j                        5  t        | 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r$   )	r   r   r  r   r   r  r   r!  	_Gtk_main)r3   r   s     r   mainr  E  st     %S]]3	.4++3356>>s}}M	. d-f-		. 	. 	. 	. 	. 	. 	.s$   ABA=*	B=B	BBc                      t        t        j                  j                               j	                         5  t               cd d d        S # 1 sw Y   y xY wr$   )r   r   r  r   paused_Gtk_main_iterationr   r   r   main_iterationr  P  s=    D,,4467>>@ 	)&(	) 	) 	)s   
A

Ac                     t        t        j                  j                               j	                         5  t        |       cd d d        S # 1 sw Y   y xY wr$   )r   r   r  r   r  _Gtk_main_iteration_do)blockings    r   main_iteration_dor  U  s?    D,,4467>>@ 	4)(3	4 	4 	4s   AAstock_lookupr   F)dsysr  gi.repositoryr   r   _ossighelperr   r   r   r   r	   	overridesr
   r   r   r   moduler   gir   r   r   _versionri   rh   __all__r   r   r"   r5   r7   rF   rm   objectr   r   r   r   r   r   r   r   r   r   r   r   r;   r   r   r6  rD  rG  rI  rK  rO  rV  rX  r[  r^  r  r  r  r  r  r  r  r  rd  rs  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r  r  r  r  r  r  r   r   
init_checkargvrH   r   r   r   <module>r,     s
  &   ' C >  . 1 u%
||u
||u
  z  6  * +	4 	 ( )  NN+,6$% %2%SZZ 2%j 
&	 x  #NCMM6 #NJ #INN;Is||  H z  
 
 fFNN8
coo 
 ;'KNN=!}Jcoo }J~ ;'KNN=!
KCMM 
K #INN;Is||Y I H z  
cgg 
 3-CNN5 
CMM 
 #INN; 
3<< 
 !HNN:)Uckk )UX 7
 y  ::&&L"

(	L,SZZ , 
&	 x _,SZZ _,D 
&	 x  @))6 @  ]+MNN?# 
s77 
 $$89NN)*
C11 
 !!23NN&' 
c55 
 ##67NN() 
c55 
 ##67NN()
Ss|| 
S H z  
S^^ 
 *%JNN< J J Y	 { U U j!
 | G GT j!
 | Is|| I
 H z KP KP\ Y	 { << % ~  B)) B ]+MNN?#Xy, Xv Y	 { i8 i8X ~    ! "-)s|| -)` H z Qy, Qh Y	 { ..s||Y ..b H z KS'' K* .)   C%% & '   *LY *LX fFNN8
S^^ 
 *%JNN< 
		 

 UOENN7%0 %0P j!
 |  		9 B UOENN7
++ 
 n-NNN#$ 
S^^ 
 *%JNN< 
S^^ 
 *%JNN<  1		 1 UOENN7 
		 
 UOENN7&#++ &" wGNN9
3<< 
 !HNN:8c)) 8 ?+   ! 4	-coo 	- ;'KNN=!Bs'' B$ L)LNN>"sxx  D>DNN6]]Ncmm  Ichh. . ,, 22c  !) ") c  !4 "4
 '(8(89LNN>"#$K	.."Ksxx0KDzCHr   