3 ��<_���@s�ddlZddlZddlZddlmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZejdkrpeZneZe d �ZgZejd kr�d Zejee�Gd d �d e�Zejd �dd�Zejd�dd�Zejd�dd�ZGdd�dej�Ze e�Zejd�Gdd�dej e�Z e e �Z ejd�Gdd�dej!�Z!e e!�Z!ejd�ejd�k�r�Gdd�dej"�Z"e e"�Z"ejd�Gdd�dej#�Z#e e#�Z#ejd�Gdd �d ej$�Z$e e$�Z$ejd �Gd!d"�d"ej%�Z%e e%�Z%ejd"�Gd#d$�d$ej&e �Z&e e&�Z&ejd$�Gd%d&�d&ej'�Z'e e'�Z'ejd&�Gd'd(�d(ej(�Z(e e(�Z(ejd(�Gd)d*�d*ej)�Z)e e)�Z)ejd*�Gd+d,�d,ej*�Z*e e*�Z*ejd,�Gd-d.�d.ej+�Z+e e+�Z+ejd.�Gd/d0�d0ej,e �Z,e e,�Z,ejd0�Gd1d2�d2ej-e,�Z-e e-�Z-ejd2�ejd�k�r@Gd3d4�d4ej.�Z.e e.�Z.ejd4�Gd5d6�d6ej/�Z/e e/�Z/ejd6�ejd�k�r�Gd7d8�d8ej0�Z0e e0�Z0ejd8�Gd9d:�d:ej1�Z1e e1�Z1ejd:�Gd;d<�d�d>ej3�Z3e e3�Z3ejd>�Gd?d@�d@ej4�Z4e e4�Z4ejd@�GdAdB�dBej5�Z5e e5�Z5ejdB�GdCdD�dDej6�Z6e e6�Z6ejdD�GdEdF�dFej7�Z7e e7�Z7ejdF�GdGdH�dHej8�Z8e e8�Z8ejdH�GdIdJ�dJej9�Z9e e9�Z9ejdJ�GdKdL�dLej:�Z:e e:�Z:ejdL�GdMdN�dNej;e8e9�Z;e e;�Z;ejdN�GdOdP�dPe<�Z=ejdP�GdQdR�dRe<�Z>ejdR�GdSdT�dTej?�Z?e e?�Z?ejdT�GdUdV�dVej@e8e9�Z@e e@�Z@ejdV�GdWdX�dXejAe �ZAe eA�ZAejdX�GdYdZ�dZejB�ZBe eB�ZBejdZ�Gd[d\�d\ejC�ZCe eC�ZCejd\�Gd]d^�d^ejDe �ZDe eD�ZDejd^�Gd_d`�d`ejE�ZEe eE�ZEejd`�Gdadb�dbejF�ZFe eF�ZFejdb�Gdcdd�ddejG�ZGe eG�ZGejdd�ejd�k�r�Gdedf�dfejHe �ZHe eH�ZHejdf�Gdgdh�dhejI�ZIe eI�ZIejdh�ejd�k�rNGdidj�djejJ�ZJe eJ�ZJejdj�Gdkdl�dlejK�ZKe eK�ZKejdl�Gdmdn�dnejL�ZLe eL�ZLejdn�ejd�k�r�Gdodp�dpejM�ZMe eM�ZMejdp�Gdqdr�drejN�ZNe eN�ZNejdr�Gdsdt�dtejO�ZOe eO�ZOejdt�Gdudv�dvejP�ZPe eP�ZPejdv�ejd k�r>Gdwdx�dxejQ�ZQe eQ�ZQejdx�ejRZSe ejR�dydz��ZRejTZUe ejT�d{d|��ZTejd�k�r�e ejV�ZVejd}�ejd~k�r�ejW�nejWejX�\ZYZXeZeX�e_XdS)��N)�GObject�)�wakeup_on_signal�register_sigint_fallback)�override�strip_boolean_result�deprecated_init)�get_introspection_module)�PyGIDeprecationWarning��Gtk�2.0aBYou have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail. As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0c@s eZdZdS)�PyGTKDeprecationWarningN)�__name__� __module__� __qualname__�rr�/usr/lib64/python3.6/Gtk.pyr4srcCs8g}x.|D]&}t|tj�s&tjj|�}|j|�q W|S)z�Create 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 Z TargetEntry�new�append)�targets�target_entries�entryrrr�_construct_target_list;s    rcCs�d}t|tj�r|j|d�}n t||d�}|dkr>td|��f}t|tj�r|t|�dkrftd|��|dd�}|d}nt |�s�td|��||fS)NzHandler %s not foundrz!Handler %s tuple can not be empty�z-Handler %s is not a method, function or tuple) r� collections�Mapping�get�getattr�AttributeError�Sequence�len� TypeError�callable)� obj_or_map� handler_name�handler�argsrrr�_extract_handler_and_argsLs         r)c Cs�t||�\}}|tjj@} |dk rR| r<|j|||f|��q||j|||f|��n*| rj|j||f|��n|j||f|��dS)N)r)rZ ConnectFlagsZAFTERZconnect_object_afterZconnect_objectZ connect_after�connect) ZbuilderZgobjZ signal_namer&Z connect_obj�flagsr%r'r(�afterrrr�_builder_connect_callbackgs r-cs>eZdZeejj�Z�fdd�Z�fdd�Zddd�Z �Z S) �Widgetcs:|dk r&t|tj� r&tjjt|��}tt|�j|�dS)N)rr � TargetListrr�superr.�drag_dest_set_target_list)�self� target_list)� __class__rrr1{sz Widget.drag_dest_set_target_listcs:|dk r&t|tj� r&tjjt|��}tt|�j|�dS)N)rr r/rrr0r.�drag_source_set_target_list)r2r3)r4rrr5�sz"Widget.drag_source_set_target_listNcCsN|dkr6|j|�}|dkr*td||f��tj|j�}tjj|||�|j�S)Nz/Class "%s" does not contain style property "%s") Zfind_style_property� ValueErrorr�Value� value_typer r.�style_get_property� get_value)r2� property_name�value�proprrrr9�s   zWidget.style_get_property)N) rrrrr r.Ztranslate_coordinatesr1r5r9� __classcell__rr)r4rr.ws   r.c@sVeZdZdd�Zdd�Zdd�Zdd�ZeZee j j �Z dd d �Z d d �Z dd�Zd S)� ContainercCs t|j��S)N)r"� get_children)r2rrr�__len__�szContainer.__len__cCs ||j�kS)N)r@)r2�childrrr� __contains__�szContainer.__contains__cCs t|j��S)N)�iterr@)r2rrr�__iter__�szContainer.__iter__cCsdS)NTr)r2rrr�__bool__�szContainer.__bool__NcCsP|dkr6|j|�}|dkr*td||f��tj|j�}tjj||||�|j�S)Nz/Class "%s" does not contain child property "%s") Zfind_child_propertyr6rr7r8r r?�child_get_propertyr:)r2rBr;r<r=rrrrG�s   zContainer.child_get_propertycs��fdd�|D�S)z�sz'Container.child_get..r)r2rBZ prop_namesr)rBr2r� child_get�szContainer.child_getcKs4x.|j�D]"\}}|jdd�}|j|||�q WdS)z=Set a child properties on the given child to key/value pairs.�_�-N)�items�replaceZchild_set_property)r2rB�kwargsrIr<rrr� child_set�s zContainer.child_set)N)rrrrArCrErF� __nonzero__rr r?Zget_focus_chainrGrKrQrrrrr?�s  r?cs,eZdZ�fdd�Zeejjfd�Z�ZS)�Editablecstt|�j|d|�S)Nr�����)r0rS� insert_text)r2�text�position)r4rrrU�szEditable.insert_text)�fail_ret) rrrrUrr rS�get_selection_boundsr>rr)r4rrS�s rS�3.0c@seZdZeejjded�ZdS)�ActionrI�label�tooltip�stock_id)� arg_names�categoryN)rIr\r]r^)rrrrr r[�__init__rrrrrr[�sr[c@seZdZeejjded�ZdS) � RadioActionrIr\r]r^r<)r_r`N)rIr\r]r^r<)rrrrr rbrarrrrrrb�srbc@s<eZdZeejjd ed�Zd dd�Zd dd�Z d dd �Z dS)� ActionGrouprI)r_r`Nc sTy t|�Wntk r(td��YnXd��fdd� }x|D] }||�q@WdS)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 /group-name/action-name. zentries must be iterableNcsLt||||d�}|dk r<�dkr.|jd|�n|jd|���j||�dS)N)rIr\r]r^�activate)r[r*�add_action_with_accel)rIr^r\� acceleratorr]�callback�action)r2� user_datarr�_process_actions z0ActionGroup.add_actions.._process_action)NNNNN)rDr#)r2�entriesrirj�er)r2rir� add_actions�s  zActionGroup.add_actionscsTy t|�Wntk r(td��YnXd��fdd� }x|D] }||�q@WdS)a� 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 /group-name/action-name. zentries must be iterableNFcsXtj||||d�}|j|�|dk rH�dkr:|jd|�n|jd|���j||�dS)N)rIr\r]r^rd)r Z ToggleAction� set_activer*re)rIr^r\rfr]rgZ is_activerh)r2rirrrj3s z7ActionGroup.add_toggle_actions.._process_action)NNNNNF)rDr#)r2rkrirjrlr)r2rir�add_toggle_actionss  zActionGroup.add_toggle_actionsc s�y t|�Wntk r(td��YnXd}d��fdd� }x&|D]}||f|��}|dkrD|}qDW|dk r�|dk r�|dkr�|jd|�n|jd||�dS)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 /group-name/action-name. zentries must be iterableNrcsHt|||||d�}t|d�r&|j|��|kr8|jd��j||�|S)N)rIr\r]r^r<� join_groupT)rb�hasattrrprnre)Z group_sourcerIr^r\rfr]Z entry_valuerh)r2r<rrrjes    z6ActionGroup.add_radio_actions.._process_actionZchanged)NNNNr)rDr#r*) r2rkr<Z on_changeriZ first_actionrjrlrhr)r2r<r�add_radio_actionsBs  zActionGroup.add_radio_actions)rI)N)N)NNN) rrrrr rcrarrmrorrrrrrrc�s  - 1rcc@seZdZdd�Zddd�ZdS) � UIManagercCs0t|t�std��t|jd��}tjj|||�S)Nzbuffer must be a stringzUTF-8)r� _basestringr#r"�encoder rs�add_ui_from_string)r2�buffer�lengthrrrrv�s zUIManager.add_ui_from_stringrcCstjj|||�S)N)r rs�insert_action_group)r2rwrxrrrry�szUIManager.insert_action_groupNrT)rT)rrrrvryrrrrrs�srsc@seZdZeejj�ZdS)�ComboBoxN)rrrrr rzZget_active_iterrrrrrz�srzc@seZdZeejjded�ZdS)�Box� homogeneous�spacing)r_r`N)r|r})rrrrr r{rarrrrrr{�sr{c@s(eZdZeejjddejjie d�ZdS)� SizeGroup�mode)r_Zdeprecated_defaultsr`N)r) rrrrr r~raZ SizeGroupModeZVERTICALrrrrrr~�s r~c@seZdZeejjded�ZdS)�MenuItemr\)r_r`N)r\)rrrrr r�rarrrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�BuildercCs|jt|�dS)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)Zconnect_signals_fullr-)r2r%rrr�connect_signals�s zBuilder.connect_signalscCs*t|t�std��t|�}tjj|||�S)Nzbuffer must be a string)rrtr#r"r r��add_from_string)r2rwrxrrrr��s zBuilder.add_from_stringcCs,t|t�std��t|�}tjj||||�S)Nzbuffer must be a string)rrtr#r"r r��add_objects_from_string)r2rwZ object_idsrxrrrr��s zBuilder.add_objects_from_stringN)rrrr�r�r�rrrrr��sr�c@seZdZeejjded�ZdS)�Window�type)r_r`N)r�)rrrrr r�rarrrrrr��sr�c@s\eZdZdZeejjddddd�ed �Z d d �Zd d �Z e dd��Z e dd��Z dd�ZdS)�Dialog�title�parentr+�buttons�_buttons_property� transient_for� add_buttons)r�r�)r_�ignore�deprecated_aliasesr`cOs�|j�}tt|j|��}|j|�d}|jtkrF|jjtjkrF|d7}|jdd�}|dk r�t |t j � r�t j dt|d�d|kr�|d=nd}|jdd�}|r�t j dt|d�|t jj@r�d |d <|t jj@r�d |d <|j||�|r�|j|�dS) Nrrr�z�The "buttons" argument must be a Gtk.ButtonsType enum value. Please use the "add_buttons" method for adding buttons. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations)� stacklevelr+rz�The "flags" argument for dialog construction is deprecated. Please use initializer keywords: modal=True and/or destroy_with_parent=True. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsTZmodalZdestroy_with_parent)�copy�dict�zip�_old_arg_names�updater4r�rarrr Z ButtonsType�warnings�warnrZ DialogFlagsZMODALZDESTROY_WITH_PARENT�_initr�)r2r(rP� new_kwargsZ old_kwargsr�r�r+rrrra�s0        zDialog.__init__cOs<t|j��(t��tjj|f|�|�SQRXWdQRXdS)N)rZdestroyrr r��run)r2r(rPrrrr�#s z Dialog.runcCs|j�S)N)Zget_action_area)�dialogrrr�(szDialog.cCs|j�S)N)Zget_content_area)r�rrrr�)sc GsPdd�}y&x ||�D]\}}|j||�qWWntk rJtd��YnXdS)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. css4x.|r.|dd�\}}|dd�}||fVqWdS)Nrrr)�b�t�rrrr�_button9s z#Dialog.add_buttons.._buttonz%Must pass an even number of argumentsN)Z add_button� IndexErrorr#)r2r(r�rVZresponserrrr�+s zDialog.add_buttonsN)r�r�r+r�r�)r�r�r+r�r�)r+r�)rrrr�rr r�rarr�r��propertyZ action_areaZvboxr�rrrrr��s+  r�c@s6eZdZeejjdddd�ed�Zd d �Zd d �Z d S)� MessageDialogr�r+� message_typer��message_formatr�)rVr�)r_r�r`cCs|jdd�|jd|�dS)Nzsecondary-use-markupFzsecondary-text)� set_property)r2r�rrr�format_secondary_textRs z#MessageDialog.format_secondary_textcCs|jdd�|jd|�dS)Nzsecondary-use-markupTzsecondary-text)r�)r2r�rrr�format_secondary_markupVs z%MessageDialog.format_secondary_markupN)r�r+r�r�r�) rrrrr r�rarr�r�rrrrr�Jsr�c@seZdZeejjded�ZdS)�ColorSelectionDialogr�)r_r`N)r�)rrrrr r�rarrrrrr�`sr�c@seZdZeejjded�ZdS)�FileChooserDialogr�r�rhr�)r_r`N)r�r�rhr�)rrrrr r�rarrrrrr�isr�c@seZdZeejjded�ZdS)�FontSelectionDialogr�)r_r`N)r�)rrrrr r�rarrrrrr�tsr�c@s$eZdZeejjdddied�ZdS) �RecentChooserDialogr�r��recent_managerr�Zmanager)r_r�r`N)r�r�r�r�)rrrrr r�rarrrrrr�}sr�c@sBeZdZeejjded�Zeejj �Z eejj �Z eejj �Z dS)�IconView�model)r_r`N)r�) rrrrr r�rarrZget_item_at_pos�get_visible_rangeZget_dest_item_at_posrrrrr��s   r�c@seZdZeejjded�ZdS)� ToolButtonr^)r_r`N)r^)rrrrr r�rarrrrrr��sr�c@seZdZeejj�ZdS)� IMContextN)rrrrr r�Zget_surroundingrrrrr��sr�c@seZdZeejj�ZdS)� RecentInfoN)rrrrr r�Zget_application_inforrrrr��sr�c@sfeZdZdd�Zddd�Zddd�Zdd d �Zdd d �Zdd�Zdd�Z ddd�Z e e j jfd�ZdS)� TextBuffercCs&|j�}|dkr"tj�}|j|�|S)N)� get_tag_tabler Z TextTagTableZ set_tag_table)r2�tablerrr�_get_or_create_tag_table�s  z#TextBuffer._get_or_create_tag_tableNcKs&tjfd|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. rI)r ZTextTagr��add)r2Ztag_nameZ properties�tagrrr� create_tag�szTextBuffer.create_tagFcCstjj||||�S)N)r r�� create_mark)r2Z mark_name�whereZ left_gravityrrrr��szTextBuffer.create_markrcCstjj|||�dS)N)r r��set_text)r2rVrxrrrr��szTextBuffer.set_textcCs0t|t�stdt|���tjj||||�dS)Nztext must be a string, not %s)rrtr#r�r r��insert)r2rDrVrxrrrr��s zTextBuffer.insertcGsF|j�}|j||�|sdS|j|�}x|D]}|j|||�q,WdS)N)Z get_offsetr�Zget_iter_at_offsetZ apply_tag)r2rDrV�tagsZ start_offset�startr�rrr�insert_with_tags�s   zTextBuffer.insert_with_tagscGsPg}x4|D],}|j�j|�}|s,td|��|j|�q W|j||f|��dS)Nzunknown text tag: %s)r��lookupr6rr�)r2rDrVr�Ztag_objsr�Ztag_objrrr�insert_with_tags_by_name�s  z#TextBuffer.insert_with_tags_by_namecCs.t|t�stdt|���tjj|||�dS)Nztext must be a string, not %s)rrtr#r�r r��insert_at_cursor)r2rVrxrrrr��s zTextBuffer.insert_at_cursor)rX)N)FrT)rTrT)rTrT)rT)rrrr�r�r�r�r�r�r�r�rr r�rYrrrrr��s      r�c@s$eZdZeejj�Zeejj�ZdS)�TextIterN)rrrrr r�Zforward_searchZbackward_searchrrrrr�s r�cseZdZdd�Zdd�ZeZdd�Zdd�Zd d �Zd d �Z d d�Z dd�Z e e jj�Ze e jj�Ze e jj�Ze e jj�Ze e jjed�Z�fdd�Z�fdd�Z�fdd�Zdd�Zdd�Zdd�Zdd�Z�fd d!�Z�fd"d#�Z�fd$d%�Z�fd&d'�Z�fd(d)�Z �Z!S)*� TreeModelcCs |jd�S)N)Ziter_n_children)r2rrrrAszTreeModel.__len__cCsdS)NTr)r2rrrrFszTreeModel.__bool__c Cs�t|tj�r|St|t�rv|dkrvt|�|}|dkrBtd|��y|j|�}Wn tk rptd|��YnX|Sy|j|�}Wn tk r�td|��YnX|SdS)Nrzrow index is out of bounds: %dzcould not find tree path '%s')rr �TreeIter�intr"r��get_iterr6)r2�key�index�aiterrrr�_getiters    zTreeModel._getitercCst|tj�r|St|�SdS)N)rr �TreePath)r2�pathrrr� _coerce_path-s zTreeModel._coerce_pathcCs|j|�}t||�S)N)r�� TreeModelRow)r2r�r�rrr� __getitem__3s zTreeModel.__getitem__cCs||}|j|j|�dS)N)�set_rowrD)r2r�r<�rowrrr� __setitem__7szTreeModel.__setitem__cCs|j|�}|j|�dS)N)r��remove)r2r�r�rrr� __delitem__;s zTreeModel.__delitem__cCst||j��S)N)�TreeModelRowIter�get_iter_first)r2rrrrE?szTreeModel.__iter__zinvalid tree pathcs2|j|�}tt|�j|�\}}|s.td|��|S)Nzinvalid tree path '%s')r�r0r�r�r6)r2r��successr�)r4rrr�Is   zTreeModel.get_itercs$|j�}tt|�j|�}|r |SdS)N)r�r0r�� iter_next)r2r�� next_iterr�)r4rrr�PszTreeModel.iter_nextcs$|j�}tt|�j|�}|r |SdS)N)r�r0r�� iter_previous)r2r�� prev_iterr�)r4rrr�VszTreeModel.iter_previouscCszt|t�rtd��|j�}t|�|kr.td��g}g}x:t|�D].\}}|dkrRq@|j|j||��|j|�q@W||fS)Nz%Expected a list or tuple, but got strz1row sequence has the incorrect number of elements) r�strr#� get_n_columnsr"r6� enumerater�_convert_value)r2r�� n_columns�result�columnsZcur_colr<rrr� _convert_row\s  zTreeModel._convert_rowcCs@|j|�\}}x,|D]$}||}|dkr*q|j|||�qWdS)N)r�� set_value)r2�treeiterr�Z converted_rowr��columnr<rrrr�ps  zTreeModel.set_rowcCs"t|tj�r|Stj|j|�|�S)z5Convert value to a GObject.Value of the expected type)rrr7Zget_column_type)r2r�r<rrrr�ys zTreeModel._convert_valuecGs^|j�}g}xH|D]@}t|t�s(td��|dks8||kr@td��|j|j||��qWt|�S)Nzcolumn numbers must be intsrzcolumn number is out of range)r�rr�r#r6rr:�tuple)r2r�r�r��values�colrrrr�s  z TreeModel.getcstt|�j|j|�|�S)N)r0r�� row_changedr�)r2r�rD)r4rrr��szTreeModel.row_changedcstt|�j|j|�|�S)N)r0r�� row_insertedr�)r2r�rD)r4rrr��szTreeModel.row_insertedcstt|�j|j|�|�S)N)r0r��row_has_child_toggledr�)r2r�rD)r4rrr��szTreeModel.row_has_child_toggledcstt|�j|j|��S)N)r0r�� row_deletedr�)r2r�)r4rrr��szTreeModel.row_deletedcstt|�j|j|�||�S)N)r0r��rows_reorderedr�)r2r�rDZ new_order)r4rrr��szTreeModel.rows_reordered)"rrrrArFrRr�r�r�r�r�rErr r�r�� iter_childrenZiter_nth_child� iter_parentZget_iter_from_stringr6r�r�r�r�r�r�rr�r�r�r�r�r>rr)r4rr�s6            r�cs<eZdZeejjdd�Zd�fdd� Zd �fdd� Z�Z S) � TreeSortableN)rXcstt|�j|||�dS)N)r0r�� set_sort_func)r2Zsort_column_id� sort_funcri)r4rrr��szTreeSortable.set_sort_funccstt|�j||�dS)N)r0r��set_default_sort_func)r2r�ri)r4rrr��sz"TreeSortable.set_default_sort_func)NN)N)N) rrrrr r�Zget_sort_column_idr�r�r>rr)r4rr��sr�c@seZdZeejjded�ZdS)� TreeModelSortr�)r_r`N)r�)rrrrr r�rarrrrrr��sr�c@s^eZdZdd�Zdd�Zddd�Zddd �Zdd d �Zdd d �Zddd�Z dd�Z dd�Z dS)� ListStorecGstjj|�|j|�dS)N)r r�ra�set_column_types)r2� column_typesrrrra�s zListStore.__init__cCs8|dk r&|j|�\}}|j|||�}ntjj||�}|S)N)r�Zinsert_with_valuesvr r�r�)r2rWr�r�r�rrr� _do_insert�s zListStore._do_insertNcCs |r|jd|�Stjj|�SdS)NrrT)r�r r�r)r2r�rrrr�s zListStore.appendcCs |jd|�S)Nr)r�)r2r�rrr�prepend�szListStore.prependcCs |j||�S)N)r�)r2rWr�rrrr��szListStore.insertcCs&tjj||�}|dk r"|j||�|S)N)r r�� insert_beforer�)r2�siblingr�r�rrrr��s zListStore.insert_beforecCs&tjj||�}|dk r"|j||�|S)N)r r�� insert_afterr�)r2r�r�r�rrrr�s zListStore.insert_aftercCs"|j||�}tjj||||�dS)N)r�r r�r�)r2r�r�r<rrrr��s zListStore.set_valuecs���fdd�}|r�t|dt�r@||ddd�|ddd��nlt|dttf�rzt|�dkrftd��||d|d�n2t|dt�r�|t|d�|dj��ntd��dS)Ncs|t|�t|�krtd��g}g}xDt||�D]6\}}t|t�sFtd��|j|�|j�j||��q,Wtjj ��||�dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#r�rr�rr�r r��set)�cols�valsr�r��col_numr<)r2r�rr� _set_lists�s  z!ListStore.set.._set_listsrrrzToo many argumentsz�Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.)rr�r��listr"r#r�r�)r2r�r(rr)r2r�rr�s  z ListStore.set)N)N)N)N)N) rrrrar�rr�r�r�rr�rrrrrr��s    r�c@s|eZdZdd�Zedd��Zedd��Zedd��Zed d ��Zd d �Z d d�Z dd�Z dd�Z dd�Z dd�Zdd�ZdS)r�cCsht|tj�stdt|�j��||_t|tj�r>|j|�|_ n&t|tj �rR||_ ntdt|�j��dS)Nz expected Gtk.TreeModel, %s foundz?expected Gtk.TreeIter or Gtk.TreePath, %s found) rr r�r#r�rr�r�r�rDr�)r2r�Z iter_or_pathrrrras   zTreeModelRow.__init__cCs|jj|j�S)N)r��get_pathrD)r2rrrr�&szTreeModelRow.pathcCs|j�S)N)�get_next)r2rrr�next*szTreeModelRow.nextcCs|j�S)N)� get_previous)r2rrr�previous.szTreeModelRow.previouscCs|j�S)N)� get_parent)r2rrrr�2szTreeModelRow.parentcCs"|jj|j�}|rt|j|�SdS)N)r�r�rDr�)r2r�rrrr6szTreeModelRow.get_nextcCs"|jj|j�}|rt|j|�SdS)N)r�r�rDr�)r2r�rrrr ;szTreeModelRow.get_previouscCs"|jj|j�}|rt|j|�SdS)N)r�r�rDr�)r2Z parent_iterrrrr @szTreeModelRow.get_parentcs�t|t�rH|�jj�kr&td|��n|dkr8�j|�}�jj�j|�St|t�r�|j �jj��\}}}g}x*t |||�D]}|j �jj�j|��qzW|St|t �r��fdd�|D�St dt|�j��dS)Nz!column index is out of bounds: %drcsg|] }�|�qSrr)rH�k)r2rrrJSsz,TreeModelRow.__getitem__..z0indices must be integers, slice or tuple, not %s)rr�r�r�r��_convert_negative_indexr:rD�slice�indices�rangerr�r#r�r)r2r�r��stop�stepZalist�ir)r2rr�Es     zTreeModelRow.__getitem__c Cs>t|t�rL||jj�kr&td|��n|dkr8|j|�}|jj|j||�n�t|t�r�|j |jj��\}}}t |||�}t |�t |�kr�t dt |�t |�f��x�t |�D]\}}|jj|j|||�q�Wnlt|t��r(t |�t |�k�rt dt |�t |�f��x4t||�D]\} }||| <�qWntdt|�j��dS)Nz!column index is out of bounds: %drz9attempt to assign sequence of size %d to slice of size %dz�sz#TreePath.__new__..rz-could not parse subscript '%s' as a tree path) rr�r�rt�joinr"r#r�Znew_from_string)�clsr�rrr�__new__�s      zTreePath.__new__cstt|�j�dS)N)r0r�ra)r2r(rP)r4rrra�szTreePath.__init__cCs |j�p dS)N�)Z to_string)r2rrr�__str__�szTreePath.__str__cCs|dk o|j|�dkS)Nr)�compare)r2�otherrrr�__lt__�szTreePath.__lt__cCs|dk o|j|�dkS)Nr)r!)r2r"rrr�__le__�szTreePath.__le__cCs|dk o|j|�dkS)Nr)r!)r2r"rrr�__eq__�szTreePath.__eq__cCs|dkp|j|�dkS)Nr)r!)r2r"rrr�__ne__�szTreePath.__ne__cCs|dkp|j|�dkS)Nr)r!)r2r"rrr�__gt__�szTreePath.__gt__cCs|dkp|j|�dkS)Nr)r!)r2r"rrr�__ge__�szTreePath.__ge__cCs t|j��S)N)rD� get_indices)r2rrrrE�szTreePath.__iter__cCs|j�S)N)Z get_depth)r2rrrrA�szTreePath.__len__cCs |j�|S)N)r))r2r�rrrr��szTreePath.__getitem__)r)rrrrrar r#r$r%r&r'r(rErAr�r>rr)r4rr��s r�c@s^eZdZdd�Zdd�Zddd�Zddd �Zdd d �Zdd d �Zddd�Z dd�Z dd�Z dS)� TreeStorecGstjj|�|j|�dS)N)r r*rar�)r2r�rrrra�s zTreeStore.__init__cCs<|dk r(|j|�\}}|j||||�}ntjj|||�}|S)N)r�Zinsert_with_valuesr r*r�)r2r�rWr�r�r�rrrr��s zTreeStore._do_insertNcCs|j|d|�S)NrrT)r�)r2r�r�rrrr�szTreeStore.appendcCs|j|d|�S)Nr)r�)r2r�r�rrrr��szTreeStore.prependcCs|j|||�S)N)r�)r2r�rWr�rrrr��szTreeStore.insertcCs(tjj|||�}|dk r$|j||�|S)N)r r*r�r�)r2r�r�r�r�rrrr��s zTreeStore.insert_beforecCs(tjj|||�}|dk r$|j||�|S)N)r r*rr�)r2r�r�r�r�rrrr�s zTreeStore.insert_aftercCs"|j||�}tjj||||�dS)N)r�r r*r�)r2r�r�r<rrrr��s zTreeStore.set_valuecs���fdd�}|r�t|dt�r@||ddd�|ddd��nlt|dttf�rzt|�dkrftd��||d|d�n2t|dt�r�||dj�|dj��ntd��dS)Ncs|t|�t|�krtd��g}g}xDt||�D]6\}}t|t�sFtd��|j|�|j�j||��q,Wtjj ��||�dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#r�rr�rr�r r*r)rrr�r�rr<)r2r�rrrs  z!TreeStore.set.._set_listsrrrzToo many argumentsz�Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.) rr�r�rr"r#r��keysr�)r2r�r(rr)r2r�rr�s  z TreeStore.set)N)N)N)N)N) rrrrar�rr�r�r�rr�rrrrrr*�s    r*cs�eZdZeejjded�Zeejj �Z eejj �Z eejj �Z �fdd�Z �fdd�Z d�fd d � Zd�fd d � Zd�fdd� Zdd�Z�ZS)�TreeViewr�)r_r`cs t|�}tt|�j|||�dS)N)rr0r,�enable_model_drag_source)r2Zstart_button_maskr�actionsr)r4rrr-)s z!TreeView.enable_model_drag_sourcecst|�}tt|�j||�dS)N)rr0r,�enable_model_drag_dest)r2rr.r)r4rrr//s zTreeView.enable_model_drag_destNF�cs0t|tj�st|�}tt|�j|||||�dS)N)rr r�r0r,�scroll_to_cell)r2r�r�Z use_alignZ row_alignZ col_align)r4rrr14s zTreeView.scroll_to_cellcs,t|tj�st|�}tt|�j|||�dS)N)rr r�r0r,� set_cursor)r2r�r�Z start_editing)r4rrr29s zTreeView.set_cursorcs&t|tj�st|�}tt|�j||�S)N)rr r�r0r,� get_cell_area)r2r�r�)r4rrr3>s zTreeView.get_cell_areacKs:t�}|j|�|j|d�|j||�|j|f|�dS)NF)�TreeViewColumnZ set_title� pack_startZ insert_column�set_attributes)r2rWr�ZcellrPr�rrr�insert_column_with_attributesCs    z&TreeView.insert_column_with_attributes)r�)NFr0r0)NF)N)rrrrr r,rarrZget_path_at_posr�Zget_dest_row_at_posr-r/r1r2r3r7r>rr)r4rr, s     r,cs<eZdZd dd�Zeejj�Zd �fdd� Zdd�Z �Z S) r4rNcKsHtjj||d�|r |j|d�x"|j�D]\}}|j|||�q*WdS)N)r�T)r r4rar5rN� add_attribute)r2r�� cell_renderer� attributesrIr<rrrraPs  zTreeViewColumn.__init__cstt|�j|||�dS)N)r0r4�set_cell_data_func)r2r9�funcZ func_data)r4rrr;\sz!TreeViewColumn.set_cell_data_funccKs:tjj||�x&|j�D]\}}tjj||||�qWdS)N)r Z CellLayoutZclear_attributesrNr8)r2r9r:rIr<rrrr6_szTreeViewColumn.set_attributes)rN)N) rrrrarr r4Zcell_get_positionr;r6r>rr)r4rr4Os  r4cs4eZdZ�fdd�Z�fdd�Z�fdd�Z�ZS)� TreeSelectioncs(t|tj�st|�}tt|�j|�dS)N)rr r�r0r=� select_path)r2r�)r4rrr>ls zTreeSelection.select_pathcs,tt|�j�\}}}|r ||fS|dfSdS)N)r0r=� get_selected)r2r�r�r�)r4rrr?qszTreeSelection.get_selectedcstt|�j�\}}||fS)N)r0r=�get_selected_rows)r2�rowsr�)r4rrr@zszTreeSelection.get_selected_rows)rrrr>r?r@r>rr)r4rr=js  r=c@s*eZdZeejjd d edd�Zdd�Zd S) �Buttonr\�stock� use_stock� use_underliner )r_r�r`r�cOsld|kr\|dr\tjdtdd�|j�}|d|d<d|d<d|d<|d=tjj|f|�n |j||�dS) NrCzKStock items are deprecated. Please use: Gtk.Button.new_with_mnemonic(label)r)r�r\TrDrE)r�r�rr�r rBrar�)r2r(rPr�rrrra�s  zButton.__init__N)r\rCrDrE)rC) rrrrr rBrarr�rrrrrB�s rBc@seZdZeejjded�ZdS)� LinkButton�urir\)r_r`N)rGr\)rrrrr rFrarrrrrrF�srFc@seZdZeejjded�ZdS)�Labelr\)r_r`N)r\)rrrrr rHrarrrrrrH�srHc@s0eZdZeejjdddd �ed d �Zd d �ZdS)� Adjustmentr<�lower�upper�step_increment�page_increment� page_sizeZ page_incrZ step_incr)rMrLr )r_r�r`r�cOsB|j||�d|kr$|j|d�nt|�dkr>|j|d�dS)Nr<rr)r�r�r")r2r(rPrrrra�s   zAdjustment.__init__N)r<rJrKrLrMrN) rrrrr rIrarr�rrrrrI�srIc@sPeZdZeejjd ddd�ed�Zejj ejj Bejj ejj Bddfd d �Z d S) �Table�n_rowsr�r|rAr�)rPr�)r_r�r`rc Cs"tjj|||||||||| � dS)N)r rO�attach) r2rBZ left_attachZ right_attachZ top_attachZ bottom_attachZxoptionsZyoptionsZxpaddingZypaddingrrrrQ�sz Table.attachN)rPr�r|) rrrrr rOrarZ AttachOptionsZEXPANDZFILLrQrrrrrO�s rOc@seZdZeejjded�ZdS)�ScrolledWindow� hadjustment� vadjustment)r_r`N)rSrT)rrrrr rRrarrrrrrR�srRc@seZdZeejjded�ZdS)� HScrollbar� adjustment)r_r`N)rV)rrrrr rUrarrrrrrU�srUc@seZdZeejjded�ZdS)� VScrollbarrV)r_r`N)rV)rrrrr rWrarrrrrrW�srWcs,eZdZd�fdd� Zd�fdd� Z�ZS) �PanedFTcstt|�j|||�dS)N)r0rX�pack1)r2rB�resize�shrink)r4rrrY�sz Paned.pack1cstt|�j|||�dS)N)r0rX�pack2)r2rBrZr[)r4rrr\�sz Paned.pack2)FT)TT)rrrrYr\r>rr)r4rrX�srXc@seZdZeejjded�ZdS)�Arrow� arrow_type� shadow_type)r_r`N)r^r_)rrrrr r]rarrrrrr]sr]cs&eZdZddd�Z�fdd�Z�ZS)�IconSetNcCs6|dk r&tjdtdd�tjj|�}n tjj|�}|S)NzXGtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf)r)r�)r�r�rr r`Znew_from_pixbufr)rZpixbufZiconsetrrrrs   zIconSet.__new__cstt|�j�S)N)r0r`ra)r2r(rP)r4rrraszIconSet.__init__)N)rrrrrar>rr)r4rr` s r`c@seZdZeejjded�ZdS)�ViewportrSrT)r_r`N)rSrT)rrrrr rararrrrrrasracs&eZdZd�fdd� Zdd�Z�ZS)�TreeModelFilterNcstt|�j||�dS)N)r0rb�set_visible_func)r2r<�data)r4rrrc*sz TreeModelFilter.set_visible_funccCs |j|�}|j�j|||�dS)N)Zconvert_iter_to_child_iterZ get_modelr�)r2rDr�r<rrrr�-s zTreeModelFilter.set_value)N)rrrrcr�r>rr)r4rrb)srbc@seZdZdd�ZdS)�MenucCs|jd||||||�dS)N)Zpopup_for_device)r2Zparent_menu_shellZparent_menu_itemr<rdZbuttonZ activate_timerrr�popup8sz Menu.popupN)rrrrfrrrrre7srecGs t�dS)N)�_Gtk_main_quit)r(rrr� main_quit@srhcOs2ttj��t�� t||�SQRXWdQRXdS)N)rr rhr� _Gtk_main)r(rPrrr�mainHs rj� stock_lookupz4.0)r r)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)[r�sysr�Z gi.repositoryrZ _ossighelperrrZ overridesrrr�moduler Zgir � version_infor�rtZ basestringr �__all__Z_versionZwarn_msgr��RuntimeWarningrrrr)r-r.r?rSr[rbrcrsrzr{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�r�r�r*r,r4r=rBrFrHrIrOrRrUrWrXr]r`rarbrerhrgrjrirkZ init_check�argvZ initializedrrrrr�s|          )     $          X              Q      S g  1 N +