/usr/share/gtk-doc/html/pygtk/class-gtktreeselection.html is in python-gtk2-doc 2.24.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.TreeSelection</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtktreerowreference.html" title="gtk.TreeRowReference"><link rel="next" href="class-gtktreesortable.html" title="gtk.TreeSortable"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.TreeSelection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtktreerowreference.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtktreesortable.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.TreeSelection"><a name="class-gtktreeselection"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.TreeSelection</h2><p>gtk.TreeSelection — the selection object for <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a></p></div><div class="refsect1" title="Synopsis"><a name="id4030117"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.TreeSelection</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--set-mode" title="gtk.TreeSelection.set_mode">set_mode</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--get-mode" title="gtk.TreeSelection.get_mode">get_mode</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--set-select-function" title="gtk.TreeSelection.set_select_function">set_select_function</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>full</code></strong></span><span class="initializer">=False</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--get-tree-view" title="gtk.TreeSelection.get_tree_view">get_tree_view</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--get-selected" title="gtk.TreeSelection.get_selected">get_selected</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--get-selected-rows" title="gtk.TreeSelection.get_selected_rows">get_selected_rows</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--count-selected-rows" title="gtk.TreeSelection.count_selected_rows">count_selected_rows</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--selected-foreach" title="gtk.TreeSelection.selected_foreach">selected_foreach</a></span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>func</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>data</code></em></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-path" title="gtk.TreeSelection.select_path">select_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--unselect-path" title="gtk.TreeSelection.unselect_path">unselect_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-iter" title="gtk.TreeSelection.select_iter">select_iter</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--unselect-iter" title="gtk.TreeSelection.unselect_iter">unselect_iter</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--path-is-selected" title="gtk.TreeSelection.path_is_selected">path_is_selected</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--iter-is-selected" title="gtk.TreeSelection.iter_is_selected">iter_is_selected</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-all" title="gtk.TreeSelection.select_all">select_all</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--unselect-all" title="gtk.TreeSelection.unselect_all">unselect_all</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-range" title="gtk.TreeSelection.select_range">select_range</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>start_path</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>end_path</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktreeselection.html#method-gtktreeselection--unselect-range" title="gtk.TreeSelection.unselect_range">unselect_range</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>start_path</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>end_path</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id4030668"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection">gtk.TreeSelection</a>
</pre></div><div class="refsect1" title="gtk.TreeSelection Signal Prototypes"><a name="signal-prototypes-gtktreeselection"></a><h2>gtk.TreeSelection Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtktreeselection.html#signal-gtktreeselection--changed" title='The "changed" gtk.TreeSelection Signal'>changed</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>treeselection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id4030785"></a><h2>Description</h2><p>The <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection"><code class="classname">gtk.TreeSelection</code></a>
object is a helper object to manage the selection for a <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a>
widget. The <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection"><code class="classname">gtk.TreeSelection</code></a>
object is automatically created when a new <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a>
widget is created, and cannot exist independent of this widget. The primary
reason the <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection"><code class="classname">gtk.TreeSelection</code></a>
object exists is for cleanliness of code and API. That is, there is no
conceptual reason all these functions could not be methods on the <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a>
widget instead of a separate function. The <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection"><code class="classname">gtk.TreeSelection</code></a>
object is retrieved from a <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a> by
calling the <a class="link" href="class-gtktreeview.html#method-gtktreeview--get-selection" title="gtk.TreeView.get_selection"><code class="methodname">gtk.TreeView.get_selection</code>()</a>
method. It can be manipulated to check the selection status of the tree, as
well as select and deselect individual rows. Selection is done completely on
the view side. As a result, multiple views of the same model can have
completely different selections. Additionally, you cannot change the
selection of a row on the model that is not currently displayed by the view
without expanding its parents first.</p><p>One of the important things to remember when monitoring the
selection of a view is that the "changed" signal is mostly a hint. That is,
it may only emit one signal when a range of rows is selected. Additionally,
it may on occasion emit a "changed" signal when nothing has happened (mostly
as a result of programmers calling the <a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-path" title="gtk.TreeSelection.select_path"><code class="methodname">select_path</code>()</a>
or <a class="link" href="class-gtktreeselection.html#method-gtktreeselection--select-iter" title="gtk.TreeSelection.select_iter"><code class="methodname">select_iter</code>()</a>
methods on an already selected row).</p></div><div class="refsect1" title="Methods"><a name="id4030905"></a><h2>Methods</h2><div class="refsect2" title="gtk.TreeSelection.set_mode"><a name="method-gtktreeselection--set-mode"></a><h3>gtk.TreeSelection.set_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_mode</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>type</code></strong> :</span></p></td><td>the selection mode</td></tr></tbody></table><p>The <code class="methodname">set_mode</code>() method sets the
selection mode of the treeselection to the mode specified by
<em class="parameter"><code>type</code></em>. The value of <em class="parameter"><code>type</code></em> must
be one of: <code class="literal">gtk.SELECTION_NONE</code>,
<code class="literal">gtk.SELECTION_SINGLE</code>,
<code class="literal">gtk.SELECTION_BROWSE</code> or
<code class="literal">gtk.SELECTION_MULTIPLE</code>. See the <a class="xref" href="gtk-constants.html#gtk-selection-mode-constants" title="GTK Selection Mode Constants">GTK Selection Mode Constants</a> description for more
detail.</p><p>If the previous type was
<code class="literal">gtk.SELECTION_MULTIPLE</code>, then the anchor is kept selected,
if it was previously selected.</p></div><div class="refsect2" title="gtk.TreeSelection.get_mode"><a name="method-gtktreeselection--get-mode"></a><h3>gtk.TreeSelection.get_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_mode</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the current selection mode</td></tr></tbody></table><p>The <code class="methodname">get_mode</code>() method returns the
selection mode for treeselection. See the <a class="link" href="class-gtktreeselection.html#method-gtktreeselection--set-mode" title="gtk.TreeSelection.set_mode"><code class="methodname">set_mode</code>()</a>
method for more information.</p></div><div class="refsect2" title="gtk.TreeSelection.set_select_function"><a name="method-gtktreeselection--set-select-function"></a><h3>gtk.TreeSelection.set_select_function</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_select_function</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>full</code></strong></span><span class="initializer">=False</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td>the selection function.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>the selection function's
data.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>full</code></em> :</span></p></td><td>if <code class="literal">True</code>
<em class="parameter"><code>func</code></em> will be passed a full set of
args</td></tr></tbody></table><p>The <code class="methodname">set_selection_function</code>() method
sets the selection function to <em class="parameter"><code>func</code></em> (a function or
method). If the selection function is set, it is called before any node is
selected or unselected, giving some control over which nodes are selected.
The selection function should return <code class="literal">True</code> if the state of
the node may be toggled, and <code class="literal">False</code> if the state of the
node should be left unchanged. The signature of the selection function
callback is:</p><pre class="programlisting">
<code class="methodsynopsis"> def <span class="methodname">selectfunction</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>info</code></em></span></span>)</code><br>
<code class="methodsynopsis"> def <span class="methodname">selectmethod</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>self</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>info</code></em></span></span>)</code>
</pre><p>where <em class="parameter"><code>info</code></em> is a tuple containing a path or a
path and <em class="parameter"><code>data</code></em> if <em class="parameter"><code>data</code></em> was
passed to the <a class="link" href="class-gtktreeselection.html#method-gtktreeselection--set-select-function" title="gtk.TreeSelection.set_select_function"><code class="methodname">set_select_function</code>()</a>
method.</p><p>In PyGTK 2.10 and above if the additional optional parameter
<em class="parameter"><code>full</code></em> is <code class="literal">True</code> the signature of
<em class="parameter"><code>func</code></em> should be:</p><pre class="programlisting">
<code class="methodsynopsis"> def <span class="methodname">selectfunction</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>selection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>model</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>path</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>path_currently_selected</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_data</code></em></span></span>)</code><br>
<code class="methodsynopsis"> def <span class="methodname">selectmethod</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>self</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>selection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>model</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>path</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>is_selected</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_data</code></em></span></span>)</code>
</pre><p>where <em class="parameter"><code>selection</code></em> is the <a class="link" href="class-gtktreeselection.html" title="gtk.TreeSelection"><code class="classname">gtk.TreeSelection</code></a>,
<em class="parameter"><code>model</code></em> is the <a class="link" href="class-gtktreemodel.html" title="gtk.TreeModel"><code class="classname">gtk.TreeModel</code></a>
used by the <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a>
associated with selection, <em class="parameter"><code>path</code></em> is the path of
the selected row, <em class="parameter"><code>is_selected</code></em> is
<code class="literal">True</code> if the row is currently selected and
<em class="parameter"><code>user_data</code></em> is <em class="parameter"><code>data</code></em> if any
(may not be present if <em class="parameter"><code>data</code></em> was
<code class="literal">None</code>). If <em class="parameter"><code>func</code></em> is a method
then <em class="parameter"><code>self</code></em> is the object that the method is
called upon.</p></div><div class="refsect2" title="gtk.TreeSelection.get_tree_view"><a name="method-gtktreeselection--get-tree-view"></a><h3>gtk.TreeSelection.get_tree_view</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_tree_view</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a></td></tr></tbody></table><p>The <code class="methodname">get_tree_iter</code>() method returns the
tree view associated with the treeselection.</p></div><div class="refsect2" title="gtk.TreeSelection.get_selected"><a name="method-gtktreeselection--get-selected"></a><h3>gtk.TreeSelection.get_selected</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_selected</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 2-tuple containing a reference to the <a class="link" href="class-gtktreemodel.html" title="gtk.TreeModel"><code class="classname">gtk.TreeModel</code></a> and
a <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a>
pointing to the currently selected node.</td></tr></tbody></table><p>The <code class="methodname">get_selected</code>() method returns a
2-tuple containing the treemodel and a treeiter pointing to the selected node
in the treemodel if the treeselection is set to
<code class="literal">gtk.SELECTION_SINGLE</code> or
<code class="literal">gtk.SELECTION_BROWSE</code>. The returned <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a> will
be <code class="literal">None</code> if there is no row selected. This method will not
work if you use <em class="parameter"><code>selection</code></em> is
<code class="literal">gtk.SELECTION_MULTIPLE</code>.</p></div><div class="refsect2" title="gtk.TreeSelection.get_selected_rows"><a name="method-gtktreeselection--get-selected-rows"></a><h3>gtk.TreeSelection.get_selected_rows</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_selected_rows</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 2-tuple containing the tree model and a list
of the tree paths of all selected rows.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">get_selected_rows</code>() method returns
a 2-tuple containing a <a class="link" href="class-gtktreemodel.html" title="gtk.TreeModel"><code class="classname">gtk.TreeModel</code></a> and
a list of the tree paths of all selected rows. Additionally, if you are
planning on modifying the tree model after calling this method, you may want
to convert the returned list into a list of <a class="link" href="class-gtktreerowreference.html" title="gtk.TreeRowReference"><code class="classname">gtk.TreeRowReference</code></a>
objects. To do this, you can use the <a class="link" href="class-gtktreerowreference.html#constructor-gtktreerowreference" title="Constructor">gtk.TreeRowReference</a>()
constructor.</p></div><div class="refsect2" title="gtk.TreeSelection.count_selected_rows"><a name="method-gtktreeselection--count-selected-rows"></a><h3>gtk.TreeSelection.count_selected_rows</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">count_selected_rows</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>The number of rows selected.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">count_selected_rows</code>() method
returns the number of rows that have been selected.</p></div><div class="refsect2" title="gtk.TreeSelection.selected_foreach"><a name="method-gtktreeselection--selected-foreach"></a><h3>gtk.TreeSelection.selected_foreach</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">selected_foreach</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>func</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>data</code></em></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td>the function or method to call for each
selected node.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>the user data to pass to
<em class="parameter"><code>func</code></em>.</td></tr></tbody></table><p>The <code class="methodname">selected_foreach</code>() method calls the
function or method specified by <em class="parameter"><code>func</code></em> for each
selected node passing the user data specified by
<em class="parameter"><code>data</code></em>. The signature of <em class="parameter"><code>func</code></em>
is:</p><pre class="programlisting">
<code class="methodsynopsis"> def <span class="methodname">foreachfunction</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>treemodel</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>path</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>iter</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code><br>
<code class="methodsynopsis"> def <span class="methodname">foreachmethod</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>self</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>treemodel</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>path</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>iter</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code>
</pre><p>where <em class="parameter"><code>treemodel</code></em> is the <a class="link" href="class-gtktreemodel.html" title="gtk.TreeModel"><code class="classname">gtk.TreeModel</code></a>
being viewed, <em class="parameter"><code>path</code></em> is the path of the selected row,
<em class="parameter"><code>iter</code></em> is a <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a>
pointing to the selected row and <em class="parameter"><code>...</code></em> is the user data
if any (may not be present if <em class="parameter"><code>data</code></em> was
<code class="literal">None</code>). If <em class="parameter"><code>func</code></em> is a method then
<em class="parameter"><code>self</code></em> is the object that the method is called
upon.</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You cannot modify the tree or selection in the callback
function.</p></div></div><div class="refsect2" title="gtk.TreeSelection.select_path"><a name="method-gtktreeselection--select-path"></a><h3>gtk.TreeSelection.select_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>path</code></strong> :</span></p></td><td>the tree path to be
selected.</td></tr></tbody></table><p>The <code class="methodname">select_path</code>() method selects the
row at <em class="parameter"><code>path</code></em>.</p></div><div class="refsect2" title="gtk.TreeSelection.unselect_path"><a name="method-gtktreeselection--unselect-path"></a><h3>gtk.TreeSelection.unselect_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unselect_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>path</code></strong> :</span></p></td><td>the tree path to be
unselected.</td></tr></tbody></table><p>The <code class="methodname">unselect_path</code>() method unselects
the row at <em class="parameter"><code>path</code></em>.</p></div><div class="refsect2" title="gtk.TreeSelection.select_iter"><a name="method-gtktreeselection--select-iter"></a><h3>gtk.TreeSelection.select_iter</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_iter</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>iter</code></strong> :</span></p></td><td>the <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a> to be
selected.</td></tr></tbody></table><p>The <code class="methodname">select_iter</code>() method selects the
row pointed to by the <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a>
specified by <em class="parameter"><code>iter</code></em>.</p></div><div class="refsect2" title="gtk.TreeSelection.unselect_iter"><a name="method-gtktreeselection--unselect-iter"></a><h3>gtk.TreeSelection.unselect_iter</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unselect_iter</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>iter</code></strong> :</span></p></td><td>the <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a> to be
unselected.</td></tr></tbody></table><p>The <code class="methodname">unselect_iter</code>() method unselects
the row pointed to by the <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a>
specified by <em class="parameter"><code>iter</code></em>.</p></div><div class="refsect2" title="gtk.TreeSelection.path_is_selected"><a name="method-gtktreeselection--path-is-selected"></a><h3>gtk.TreeSelection.path_is_selected</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">path_is_selected</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>path</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>path</code></strong> :</span></p></td><td>A tree path to check if
selected.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if
<em class="parameter"><code>path</code></em> is selected.</td></tr></tbody></table><p>The <code class="methodname">path_is_selected</code>() method returns
<code class="literal">True</code> if the row pointed to by <em class="parameter"><code>path</code></em>
is currently selected. If <em class="parameter"><code>path</code></em> does not point to a
valid location, <code class="literal">False</code> is returned.</p></div><div class="refsect2" title="gtk.TreeSelection.iter_is_selected"><a name="method-gtktreeselection--iter-is-selected"></a><h3>gtk.TreeSelection.iter_is_selected</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">iter_is_selected</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>iter</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>iter</code></strong> :</span></p></td><td>a <a class="link" href="class-gtktreeiter.html" title="gtk.TreeIter"><code class="classname">gtk.TreeIter</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code>, if the row pointed to
by <em class="parameter"><code>iter</code></em> is selected</td></tr></tbody></table><p>The <code class="methodname">iter_is_selected</code>() method returns
<code class="literal">True</code> if the row pointed to by <em class="parameter"><code>iter</code></em>
is currently selected.</p></div><div class="refsect2" title="gtk.TreeSelection.select_all"><a name="method-gtktreeselection--select-all"></a><h3>gtk.TreeSelection.select_all</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_all</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">select_all</code>() method selects all the
nodes. The treeselection is must be set to
<code class="literal">gtk.SELECTION_MULTIPLE</code> mode.</p></div><div class="refsect2" title="gtk.TreeSelection.unselect_all"><a name="method-gtktreeselection--unselect-all"></a><h3>gtk.TreeSelection.unselect_all</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unselect_all</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">unselect_all</code>() method unselects all
the nodes.</p></div><div class="refsect2" title="gtk.TreeSelection.select_range"><a name="method-gtktreeselection--select-range"></a><h3>gtk.TreeSelection.select_range</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_range</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>start_path</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>end_path</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>start_path</code></strong> :</span></p></td><td>the initial node path of the
range.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>end_path</code></strong> :</span></p></td><td>the final node path of the
range.</td></tr></tbody></table><p>The <code class="methodname">select_range</code>() method selects a
range of nodes specified by the tree paths
<em class="parameter"><code>start_path</code></em> and <em class="parameter"><code>end_path</code></em>
inclusive.</p></div><div class="refsect2" title="gtk.TreeSelection.unselect_range"><a name="method-gtktreeselection--unselect-range"></a><h3>gtk.TreeSelection.unselect_range</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unselect_range</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>start_path</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>end_path</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>start_path</code></em> :</span></p></td><td>The initial node of the
range.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>end_path</code></em> :</span></p></td><td>The final node of the
range.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">unselect_range</code>() method unselects
the range of nodes specified by the tree paths
<em class="parameter"><code>start_path</code></em> and <em class="parameter"><code>end_path</code></em>
inclusive.</p></div></div><div class="refsect1" title="Signals"><a name="id4033221"></a><h2>Signals</h2><div class="refsect2" title='The "changed" gtk.TreeSelection Signal'><a name="signal-gtktreeselection--changed"></a><h3>The "changed" gtk.TreeSelection Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>treeselection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>treeselection</code></em> :</span></p></td><td>the treeselection that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "changed" signal is emitted when the selection has
changed.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtktreerowreference.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtktreesortable.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.TreeRowReference </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.TreeSortable</td></tr></table></div></body></html>
|