3 <_@sddlZddlZddlZddlmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZejdkrpeZneZe d ZgZejd krd ZejeeGd d d eZejd ddZejdddZejdddZGdddejZe eZejdGdddej eZ e e Z ejdGdddej!Z!e e!Z!ejdejdkrGdddej"Z"e e"Z"ejdGdddej#Z#e e#Z#ejdGdd 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/d0d0ej,e Z,e e,Z,ejd0Gd1d2d2ej-e,Z-e e-Z-ejd2ejdkr@Gd3d4d4ej.Z.e e.Z.ejd4Gd5d6d6ej/Z/e e/Z/ejd6ejdkrGd7d8d8ej0Z0e e0Z0ejd8Gd9d:d:ej1Z1e e1Z1ejd:Gd;d<dd>ej3Z3e e3Z3ejd>Gd?d@d@ej4Z4e e4Z4ejd@GdAdBdBej5Z5e e5Z5ejdBGdCdDdDej6Z6e e6Z6ejdDGdEdFdFej7Z7e e7Z7ejdFGdGdHdHej8Z8e e8Z8ejdHGdIdJdJej9Z9e e9Z9ejdJGdKdLdLej:Z:e e:Z:ejdLGdMdNdNej;e8e9Z;e e;Z;ejdNGdOdPdPe<Z=ejdPGdQdRdRe<Z>ejdRGdSdTdTej?Z?e e?Z?ejdTGdUdVdVej@e8e9Z@e e@Z@ejdVGdWdXdXejAe ZAe eAZAejdXGdYdZdZejBZBe eBZBejdZGd[d\d\ejCZCe eCZCejd\Gd]d^d^ejDe ZDe eDZDejd^Gd_d`d`ejEZEe eEZEejd`GdadbdbejFZFe eFZFejdbGdcddddejGZGe eGZGejddejdkrGdedfdfejHe ZHe eHZHejdfGdgdhdhejIZIe eIZIejdhejdkrNGdidjdjejJZJe eJZJejdjGdkdldlejKZKe eKZKejdlGdmdndnejLZLe eLZLejdnejdkrGdodpdpejMZMe eMZMejdpGdqdrdrejNZNe eNZNejdrGdsdtdtejOZOe eOZOejdtGdudvdvejPZPe ePZPejdvejd kr>GdwdxdxejQZQe eQZQejdxejRZSe ejRdydzZRejTZUe ejTd{d|ZTejdkre ejVZVejd}ejd~krejWnejWejX\ZYZXeZeXe_XdS)N)GObject)wakeup_on_signalregister_sigint_fallback)overridestrip_boolean_resultdeprecated_init)get_introspection_module)PyGIDeprecationWarningGtk2.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|tjs&tjj|}|j|q W|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 Z TargetEntrynewappend)targetstarget_entriesentryrrr_construct_target_list;s    rcCsd}t|tjr|j|d}n t||d}|dkr>td|f}t|tjr|t|dkrftd||dd}|d}nt |std|||fS)NzHandler %s not foundrz!Handler %s tuple can not be emptyz-Handler %s is not a method, function or tuple) r collectionsMappinggetgetattrAttributeErrorSequencelen TypeErrorcallable) obj_or_map handler_namehandlerargsrrr_extract_handler_and_argsLs         r)c Cst||\}}|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_afterconnect) ZbuilderZgobjZ signal_namer&Z connect_objflagsr%r'r(afterrrr_builder_connect_callbackgs r-cs>eZdZeejjZfddZfddZdddZ Z S) Widgetcs:|dk r&t|tj r&tjjt|}tt|j|dS)N)rr TargetListrrsuperr.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)r4rrr5sz"Widget.drag_source_set_target_listNcCsN|dkr6|j|}|dkr*td||ftj|j}tjj||||jS)Nz/Class "%s" does not contain style property "%s") Zfind_style_property ValueErrorrValue value_typer r.style_get_property get_value)r2 property_namevalueproprrrr9s   zWidget.style_get_property)N) rrrrr r.Ztranslate_coordinatesr1r5r9 __classcell__rr)r4rr.ws   r.c@sVeZdZddZddZddZddZeZee j j Z dd d Z d d Z ddZd S) ContainercCs t|jS)N)r" get_children)r2rrr__len__szContainer.__len__cCs ||jkS)N)r@)r2childrrr __contains__szContainer.__contains__cCs t|jS)N)iterr@)r2rrr__iter__szContainer.__iter__cCsdS)NTr)r2rrr__bool__szContainer.__bool__NcCsP|dkr6|j|}|dkr*td||ftj|j}tjj|||||jS)Nz/Class "%s" does not contain child property "%s") Zfind_child_propertyr6rr7r8r r?child_get_propertyr:)r2rBr;r<r=rrrrGs   zContainer.child_get_propertycsfdd|DS)zsz'Container.child_get..r)r2rBZ prop_namesr)rBr2r child_getszContainer.child_getcKs4x.|jD]"\}}|jdd}|j|||q WdS)z=Set a child properties on the given child to key/value pairs._-N)itemsreplaceZchild_set_property)r2rBkwargsrIr<rrr child_sets zContainer.child_set)N)rrrrArCrErF __nonzero__rr r?Zget_focus_chainrGrKrQrrrrr?s  r?cs,eZdZfddZeejjfdZZS)Editablecstt|j|d|S)Nr)r0rS insert_text)r2textposition)r4rrrUszEditable.insert_text)fail_ret) rrrrUrr rSget_selection_boundsr>rr)r4rrSs rS3.0c@seZdZeejjdedZdS)ActionrIlabeltooltipstock_id) arg_namescategoryN)rIr\r]r^)rrrrr r[__init__rrrrrr[sr[c@seZdZeejjdedZdS) RadioActionrIr\r]r^r<)r_r`N)rIr\r]r^r<)rrrrr rbrarrrrrrbsrbc@s<eZdZeejjd edZd ddZd ddZ d dd Z dS) ActionGrouprI)r_r`Nc sTy t|Wntk r(tdYnXdfdd }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]callbackaction)r2 user_datarr_process_actions z0ActionGroup.add_actions.._process_action)NNNNN)rDr#)r2entriesrirjer)r2rir add_actionss  zActionGroup.add_actionscsTy t|Wntk r(tdYnXdfdd }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 rHdkr:|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)r2riradd_toggle_actionss  zActionGroup.add_toggle_actionsc sy t|Wntk r(tdYnXd}dfdd }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|dr&|j||kr8|jdj|||S)N)rIr\r]r^r< join_groupT)rbhasattrrprnre)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<radd_radio_actionsBs  zActionGroup.add_radio_actions)rI)N)N)NNN) rrrrr rcrarrmrorrrrrrrcs  - 1rcc@seZdZddZdddZdS) UIManagercCs0t|tstdt|jd}tjj|||S)Nzbuffer must be a stringzUTF-8)r _basestringr#r"encoder rsadd_ui_from_string)r2bufferlengthrrrrvs zUIManager.add_ui_from_stringrcCstjj|||S)N)r rsinsert_action_group)r2rwrxrrrryszUIManager.insert_action_groupNrT)rT)rrrrvryrrrrrssrsc@seZdZeejjZdS)ComboBoxN)rrrrr rzZget_active_iterrrrrrzsrzc@seZdZeejjdedZdS)Box homogeneousspacing)r_r`N)r|r})rrrrr r{rarrrrrr{sr{c@s(eZdZeejjddejjie dZdS) SizeGroupmode)r_Zdeprecated_defaultsr`N)r) rrrrr r~raZ SizeGroupModeZVERTICALrrrrrr~s r~c@seZdZeejjdedZdS)MenuItemr\)r_r`N)r\)rrrrr rrarrrrrrsrc@s$eZdZddZddZddZdS)BuildercCs|jt|dS)aConnect 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%rrrconnect_signalss zBuilder.connect_signalscCs*t|tstdt|}tjj|||S)Nzbuffer must be a string)rrtr#r"r radd_from_string)r2rwrxrrrrs zBuilder.add_from_stringcCs,t|tstdt|}tjj||||S)Nzbuffer must be a string)rrtr#r"r radd_objects_from_string)r2rwZ object_idsrxrrrrs zBuilder.add_objects_from_stringN)rrrrrrrrrrrsrc@seZdZeejjdedZdS)Windowtype)r_r`N)r)rrrrr rrarrrrrrsrc@s\eZdZdZeejjddddded Z d d Zd d Z e ddZ e ddZ ddZdS)Dialogtitleparentr+buttons_buttons_property transient_for add_buttons)rr)r_ignoredeprecated_aliasesr`cOs|j}tt|j|}|j|d}|jtkrF|jjtjkrF|d7}|jdd}|dk rt |t j  rt j dt|dd|kr|d=nd}|jdd}|rt j dt|d|t jj@rd |d <|t jj@rd |d <|j|||r|j|dS) NrrrzThe "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+rzThe "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)copydictzip_old_arg_namesupdater4rrarrr Z ButtonsTypewarningswarnrZ DialogFlagsZMODALZDESTROY_WITH_PARENT_initr)r2r(rP new_kwargsZ old_kwargsrrr+rrrras0        zDialog.__init__cOs<t|j(ttjj|f||SQRXWdQRXdS)N)rZdestroyrr rrun)r2r(rPrrrr#s z Dialog.runcCs|jS)N)Zget_action_area)dialogrrr(szDialog.cCs|jS)N)Zget_content_area)rrrrr)sc GsPdd}y&x ||D]\}}|j||qWWntk rJtdYnXdS)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)btrrrr_button9s z#Dialog.add_buttons.._buttonz%Must pass an even number of argumentsN)Z add_button IndexErrorr#)r2r(rrVZresponserrrr+s zDialog.add_buttonsN)rrr+rr)rrr+rr)r+r)rrrrrr rrarrrpropertyZ action_areaZvboxrrrrrrs+  rc@s6eZdZeejjddddedZd d Zd d Z d S) MessageDialogrr+ message_typermessage_formatr)rVr)r_rr`cCs|jdd|jd|dS)Nzsecondary-use-markupFzsecondary-text) set_property)r2rrrrformat_secondary_textRs z#MessageDialog.format_secondary_textcCs|jdd|jd|dS)Nzsecondary-use-markupTzsecondary-text)r)r2rrrrformat_secondary_markupVs z%MessageDialog.format_secondary_markupN)rr+rrr) rrrrr rrarrrrrrrrJsrc@seZdZeejjdedZdS)ColorSelectionDialogr)r_r`N)r)rrrrr rrarrrrrr`src@seZdZeejjdedZdS)FileChooserDialogrrrhr)r_r`N)rrrhr)rrrrr rrarrrrrrisrc@seZdZeejjdedZdS)FontSelectionDialogr)r_r`N)r)rrrrr rrarrrrrrtsrc@s$eZdZeejjdddiedZdS) RecentChooserDialogrrrecent_managerrZmanager)r_rr`N)rrrr)rrrrr rrarrrrrr}src@sBeZdZeejjdedZeejj Z eejj Z eejj Z dS)IconViewmodel)r_r`N)r) rrrrr rrarrZget_item_at_posget_visible_rangeZget_dest_item_at_posrrrrrs   rc@seZdZeejjdedZdS) ToolButtonr^)r_r`N)r^)rrrrr rrarrrrrrsrc@seZdZeejjZdS) IMContextN)rrrrr rZget_surroundingrrrrrsrc@seZdZeejjZdS) RecentInfoN)rrrrr rZget_application_inforrrrrsrc@sfeZdZddZdddZdddZdd d Zdd d ZddZddZ dddZ e e j jfdZdS) TextBuffercCs&|j}|dkr"tj}|j||S)N) get_tag_tabler Z TextTagTableZ set_tag_table)r2tablerrr_get_or_create_tag_tables  z#TextBuffer._get_or_create_tag_tableNcKs&tjfd|i|}|jj||S)aCreates 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 ZTextTagradd)r2Ztag_nameZ propertiestagrrr create_tagszTextBuffer.create_tagFcCstjj||||S)N)r r create_mark)r2Z mark_namewhereZ left_gravityrrrrszTextBuffer.create_markrcCstjj|||dS)N)r rset_text)r2rVrxrrrrszTextBuffer.set_textcCs0t|tstdt|tjj||||dS)Nztext must be a string, not %s)rrtr#rr rinsert)r2rDrVrxrrrrs zTextBuffer.insertcGsF|j}|j|||sdS|j|}x|D]}|j|||q,WdS)N)Z get_offsetrZget_iter_at_offsetZ apply_tag)r2rDrVtagsZ start_offsetstartrrrrinsert_with_tagss   zTextBuffer.insert_with_tagscGsPg}x4|D],}|jj|}|s,td||j|q W|j||f|dS)Nzunknown text tag: %s)rlookupr6rr)r2rDrVrZtag_objsrZtag_objrrrinsert_with_tags_by_names  z#TextBuffer.insert_with_tags_by_namecCs.t|tstdt|tjj|||dS)Nztext must be a string, not %s)rrtr#rr rinsert_at_cursor)r2rVrxrrrrs zTextBuffer.insert_at_cursor)rX)N)FrT)rTrT)rTrT)rT)rrrrrrrrrrrrr rrYrrrrrs      rc@s$eZdZeejjZeejjZdS)TextIterN)rrrrr rZforward_searchZbackward_searchrrrrrs rcseZdZddZddZeZddZddZd d Zd d Z d dZ ddZ e e jjZe e jjZe e jjZe e jjZe e jjedZfddZfddZfddZddZddZddZddZfd d!Zfd"d#Zfd$d%Zfd&d'Zfd(d)Z Z!S)* TreeModelcCs |jdS)N)Ziter_n_children)r2rrrrAszTreeModel.__len__cCsdS)NTr)r2rrrrFszTreeModel.__bool__c Cst|tjr|St|trv|dkrvt||}|dkrBtd|y|j|}Wn tk rptd|YnX|Sy|j|}Wn tk rtd|YnX|SdS)Nrzrow index is out of bounds: %dzcould not find tree path '%s')rr TreeIterintr"rget_iterr6)r2keyindexaiterrrr_getiters    zTreeModel._getitercCst|tjr|St|SdS)N)rr TreePath)r2pathrrr _coerce_path-s zTreeModel._coerce_pathcCs|j|}t||S)N)r TreeModelRow)r2rrrrr __getitem__3s zTreeModel.__getitem__cCs||}|j|j|dS)N)set_rowrD)r2rr<rowrrr __setitem__7szTreeModel.__setitem__cCs|j|}|j|dS)N)rremove)r2rrrrr __delitem__;s zTreeModel.__delitem__cCst||jS)N)TreeModelRowIterget_iter_first)r2rrrrE?szTreeModel.__iter__zinvalid tree pathcs2|j|}tt|j|\}}|s.td||S)Nzinvalid tree path '%s')rr0rrr6)r2rsuccessr)r4rrrIs   zTreeModel.get_itercs$|j}tt|j|}|r |SdS)N)rr0r iter_next)r2r next_iterr)r4rrrPszTreeModel.iter_nextcs$|j}tt|j|}|r |SdS)N)rr0r iter_previous)r2r prev_iterr)r4rrrVszTreeModel.iter_previouscCszt|trtd|j}t||kr.tdg}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) rstrr# get_n_columnsr"r6 enumerater_convert_value)r2r n_columnsresultcolumnsZcur_colr<rrr _convert_row\s  zTreeModel._convert_rowcCs@|j|\}}x,|D]$}||}|dkr*q|j|||qWdS)N)r set_value)r2treeiterrZ converted_rowrcolumnr<rrrrps  zTreeModel.set_rowcCs"t|tjr|Stj|j||S)z5Convert value to a GObject.Value of the expected type)rrr7Zget_column_type)r2rr<rrrrys zTreeModel._convert_valuecGs^|j}g}xH|D]@}t|ts(td|dks8||kr@td|j|j||qWt|S)Nzcolumn numbers must be intsrzcolumn number is out of range)rrrr#r6rr:tuple)r2rrrvaluescolrrrrs  z TreeModel.getcstt|j|j||S)N)r0r row_changedr)r2rrD)r4rrrszTreeModel.row_changedcstt|j|j||S)N)r0r row_insertedr)r2rrD)r4rrrszTreeModel.row_insertedcstt|j|j||S)N)r0rrow_has_child_toggledr)r2rrD)r4rrrszTreeModel.row_has_child_toggledcstt|j|j|S)N)r0r row_deletedr)r2r)r4rrrszTreeModel.row_deletedcstt|j|j|||S)N)r0rrows_reorderedr)r2rrDZ new_order)r4rrrszTreeModel.rows_reordered)"rrrrArFrRrrrrrrErr rr iter_childrenZiter_nth_child iter_parentZget_iter_from_stringr6rrrrrrrrrrrrr>rr)r4rrs6            rcs<eZdZeejjddZdfdd Zd fdd ZZ S) TreeSortableN)rXcstt|j|||dS)N)r0r set_sort_func)r2Zsort_column_id sort_funcri)r4rrrszTreeSortable.set_sort_funccstt|j||dS)N)r0rset_default_sort_func)r2rri)r4rrrsz"TreeSortable.set_default_sort_func)NN)N)N) rrrrr rZget_sort_column_idrrr>rr)r4rrsrc@seZdZeejjdedZdS) TreeModelSortr)r_r`N)r)rrrrr rrarrrrrrsrc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) ListStorecGstjj||j|dS)N)r rraset_column_types)r2 column_typesrrrras zListStore.__init__cCs8|dk r&|j|\}}|j|||}ntjj||}|S)N)rZinsert_with_valuesvr rr)r2rWrrrrrr _do_inserts zListStore._do_insertNcCs |r|jd|Stjj|SdS)NrrT)rr rr)r2rrrrrs zListStore.appendcCs |jd|S)Nr)r)r2rrrrprependszListStore.prependcCs |j||S)N)r)r2rWrrrrrszListStore.insertcCs&tjj||}|dk r"|j|||S)N)r r insert_beforer)r2siblingrrrrrrs zListStore.insert_beforecCs&tjj||}|dk r"|j|||S)N)r r insert_afterr)r2rrrrrrrs zListStore.insert_aftercCs"|j||}tjj||||dS)N)rr rr)r2rrr<rrrrs zListStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr|t|d|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr rset)colsvalsrrcol_numr<)r2rrr _set_listss  z!ListStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.)rrrlistr"r#rr)r2rr(rr)r2rrrs  z ListStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrrs    rc@s|eZdZddZeddZeddZeddZed d Zd d Z d dZ ddZ ddZ ddZ ddZddZdS)rcCsht|tjstdt|j||_t|tjr>|j||_ n&t|tj rR||_ ntdt|jdS)Nz expected Gtk.TreeModel, %s foundz?expected Gtk.TreeIter or Gtk.TreePath, %s found) rr rr#rrrrrrDr)r2rZ iter_or_pathrrrras   zTreeModelRow.__init__cCs|jj|jS)N)rget_pathrD)r2rrrr&szTreeModelRow.pathcCs|jS)N)get_next)r2rrrnext*szTreeModelRow.nextcCs|jS)N) get_previous)r2rrrprevious.szTreeModelRow.previouscCs|jS)N) get_parent)r2rrrr2szTreeModelRow.parentcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr6szTreeModelRow.get_nextcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr ;szTreeModelRow.get_previouscCs"|jj|j}|rt|j|SdS)N)rrrDr)r2Z parent_iterrrrr @szTreeModelRow.get_parentcst|trH|jjkr&td|n|dkr8j|}jjj|St|tr|j jj\}}}g}x*t |||D]}|j jjj|qzW|St|t rfdd|DSt dt|jdS)Nz!column index is out of bounds: %drcsg|] }|qSrr)rHk)r2rrrJSsz,TreeModelRow.__getitem__..z0indices must be integers, slice or tuple, not %s)rrrrr_convert_negative_indexr:rDsliceindicesrangerrr#rr)r2rrstopstepZalistir)r2rrEs     zTreeModelRow.__getitem__c Cs>t|trL||jjkr&td|n|dkr8|j|}|jj|j||nt|tr|j |jj\}}}t |||}t |t |krt dt |t |fxt |D]\}}|jj|j|||qWnlt|tr(t |t |krt dt |t |fx4t||D]\} }||| <qWntdt|jdS)Nz!column index is out of bounds: %drz9attempt to assign sequence of size %d to slice of size %dzsz#TreePath.__new__..rz-could not parse subscript '%s' as a tree path) rrrrtjoinr"r#rZnew_from_string)clsrrrr__new__s      zTreePath.__new__cstt|jdS)N)r0rra)r2r(rP)r4rrraszTreePath.__init__cCs |jp dS)N)Z to_string)r2rrr__str__szTreePath.__str__cCs|dk o|j|dkS)Nr)compare)r2otherrrr__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|jS)N)rD get_indices)r2rrrrEszTreePath.__iter__cCs|jS)N)Z get_depth)r2rrrrAszTreePath.__len__cCs |j|S)N)r))r2rrrrrszTreePath.__getitem__)r)rrrrrar r#r$r%r&r'r(rErArr>rr)r4rrs rc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) TreeStorecGstjj||j|dS)N)r r*rar)r2rrrrras zTreeStore.__init__cCs<|dk r(|j|\}}|j||||}ntjj|||}|S)N)rZinsert_with_valuesr r*r)r2rrWrrrrrrrs zTreeStore._do_insertNcCs|j|d|S)NrrT)r)r2rrrrrrszTreeStore.appendcCs|j|d|S)Nr)r)r2rrrrrrszTreeStore.prependcCs|j|||S)N)r)r2rrWrrrrrszTreeStore.insertcCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_beforecCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_aftercCs"|j||}tjj||||dS)N)rr r*r)r2rrr<rrrrs zTreeStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr||dj|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr r*r)rrrrrr<)r2rrrrs  z!TreeStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.) rrrrr"r#rkeysr)r2rr(rr)r2rrrs  z TreeStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrr*s    r*cseZdZeejjdedZeejj Z eejj Z eejj Z fddZ fddZ dfd d Zdfd d Zdfdd ZddZZS)TreeViewr)r_r`cs t|}tt|j|||dS)N)rr0r,enable_model_drag_source)r2Zstart_button_maskractionsr)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_destNFcs0t|tjst|}tt|j|||||dS)N)rr rr0r,scroll_to_cell)r2rrZ use_alignZ row_alignZ col_align)r4rrr14s zTreeView.scroll_to_cellcs,t|tjst|}tt|j|||dS)N)rr rr0r, set_cursor)r2rrZ start_editing)r4rrr29s zTreeView.set_cursorcs&t|tjst|}tt|j||S)N)rr rr0r, get_cell_area)r2rr)r4rrr3>s zTreeView.get_cell_areacKs:t}|j||j|d|j|||j|f|dS)NF)TreeViewColumnZ set_title pack_startZ insert_columnset_attributes)r2rWrZcellrPrrrrinsert_column_with_attributesCs    z&TreeView.insert_column_with_attributes)r)NFr0r0)NF)N)rrrrr r,rarrZget_path_at_posrZget_dest_row_at_posr-r/r1r2r3r7r>rr)r4rr, s     r,cs<eZdZd ddZeejjZd fdd ZddZ Z S) r4rNcKsHtjj||d|r |j|dx"|jD]\}}|j|||q*WdS)N)rT)r r4rar5rN add_attribute)r2r cell_renderer attributesrIr<rrrraPs  zTreeViewColumn.__init__cstt|j|||dS)N)r0r4set_cell_data_func)r2r9funcZ func_data)r4rrr;\sz!TreeViewColumn.set_cell_data_funccKs:tjj||x&|jD]\}}tjj||||qWdS)N)r Z CellLayoutZclear_attributesrNr8)r2r9r:rIr<rrrr6_szTreeViewColumn.set_attributes)rN)N) rrrrarr r4Zcell_get_positionr;r6r>rr)r4rr4Os  r4cs4eZdZfddZfddZfddZZS) TreeSelectioncs(t|tjst|}tt|j|dS)N)rr rr0r= select_path)r2r)r4rrr>ls zTreeSelection.select_pathcs,tt|j\}}}|r ||fS|dfSdS)N)r0r= get_selected)r2rrr)r4rrr?qszTreeSelection.get_selectedcstt|j\}}||fS)N)r0r=get_selected_rows)r2rowsr)r4rrr@zszTreeSelection.get_selected_rows)rrrr>r?r@r>rr)r4rr=js  r=c@s*eZdZeejjd d eddZddZd S) Buttonr\stock use_stock use_underliner )r_rr`rcOsld|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)rr\TrDrE)rrrrr rBrar)r2r(rPrrrrras  zButton.__init__N)r\rCrDrE)rC) rrrrr rBrarrrrrrrBs rBc@seZdZeejjdedZdS) LinkButtonurir\)r_r`N)rGr\)rrrrr rFrarrrrrrFsrFc@seZdZeejjdedZdS)Labelr\)r_r`N)r\)rrrrr rHrarrrrrrHsrHc@s0eZdZeejjdddd ed d Zd d ZdS) Adjustmentr<lowerupperstep_incrementpage_increment page_sizeZ page_incrZ step_incr)rMrLr )r_rr`rcOsB|j||d|kr$|j|dnt|dkr>|j|ddS)Nr<rr)rrr")r2r(rPrrrras   zAdjustment.__init__N)r<rJrKrLrMrN) rrrrr rIrarrrrrrrIsrIc@sPeZdZeejjd dddedZejj ejj Bejj ejj Bddfd d Z d S) Tablen_rowsrr|rAr)rPr)r_rr`rc Cs"tjj|||||||||| dS)N)r rOattach) r2rBZ left_attachZ right_attachZ top_attachZ bottom_attachZxoptionsZyoptionsZxpaddingZypaddingrrrrQsz Table.attachN)rPrr|) rrrrr rOrarZ AttachOptionsZEXPANDZFILLrQrrrrrOs rOc@seZdZeejjdedZdS)ScrolledWindow hadjustment vadjustment)r_r`N)rSrT)rrrrr rRrarrrrrrRsrRc@seZdZeejjdedZdS) HScrollbar adjustment)r_r`N)rV)rrrrr rUrarrrrrrUsrUc@seZdZeejjdedZdS) VScrollbarrV)r_r`N)rV)rrrrr rWrarrrrrrWsrWcs,eZdZdfdd Zdfdd ZZS) PanedFTcstt|j|||dS)N)r0rXpack1)r2rBresizeshrink)r4rrrYsz Paned.pack1cstt|j|||dS)N)r0rXpack2)r2rBrZr[)r4rrr\sz Paned.pack2)FT)TT)rrrrYr\r>rr)r4rrXsrXc@seZdZeejjdedZdS)Arrow arrow_type shadow_type)r_r`N)r^r_)rrrrr r]rarrrrrr]sr]cs&eZdZdddZfddZZS)IconSetNcCs6|dk r&tjdtddtjj|}n tjj|}|S)NzXGtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf)r)r)rrrr r`Znew_from_pixbufr)rZpixbufZiconsetrrrrs   zIconSet.__new__cstt|jS)N)r0r`ra)r2r(rP)r4rrraszIconSet.__init__)N)rrrrrar>rr)r4rr` s r`c@seZdZeejjdedZdS)ViewportrSrT)r_r`N)rSrT)rrrrr rararrrrrrasracs&eZdZdfdd ZddZZS)TreeModelFilterNcstt|j||dS)N)r0rbset_visible_func)r2r<data)r4rrrc*sz TreeModelFilter.set_visible_funccCs |j|}|jj|||dS)N)Zconvert_iter_to_child_iterZ get_modelr)r2rDrr<rrrr-s zTreeModelFilter.set_value)N)rrrrcrr>rr)r4rrb)srbc@seZdZddZdS)MenucCs|jd||||||dS)N)Zpopup_for_device)r2Zparent_menu_shellZparent_menu_itemr<rdZbuttonZ activate_timerrrpopup8sz Menu.popupN)rrrrfrrrrre7srecGs tdS)N)_Gtk_main_quit)r(rrr main_quit@srhcOs2ttjt t||SQRXWdQRXdS)N)rr rhr _Gtk_main)r(rPrrrmainHs rj stock_lookupz4.0)r r)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)[rsysrZ gi.repositoryrZ _ossighelperrrZ overridesrrrmoduler Zgir version_inforrtZ basestringr __all__Z_versionZwarn_msgrRuntimeWarningrrrr)r-r.r?rSr[rbrcrsrzr{r~rrrrrrrrrrrrrrrrrrrobjectrrrr*r,r4r=rBrFrHrIrOrRrUrWrXr]r`rarbrerhrgrjrirkZ init_checkargvZ initializedrrrrrs|          )     $          X              Q      S g  1 N +