Gtk.TreeStore¶
- Subclasses:
None
Methods¶
- Inherited:
GObject.Object (37), Gtk.Buildable (10), Gtk.TreeDragDest (2), Gtk.TreeDragSource (3), Gtk.TreeModel (28), Gtk.TreeSortable (6)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.TreeStore(*column_types)¶
- Bases:
GObject.Object,Gtk.Buildable,Gtk.TreeDragDest,Gtk.TreeDragSource,Gtk.TreeModel,Gtk.TreeSortable- Abstract:
No
- Structure:
The
Gtk.TreeStoreobject is a list model for use with aGtk.TreeViewwidget. It implements theGtk.TreeModelinterface, and consequentially, can use all of the methods available there. It also implements theGtk.TreeSortableinterface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.The
Gtk.TreeStoreimplementation of theGtk.Buildableinterface allows to specify the model columns with a<columns>element that may contain multiple<column>elements, each specifying one model column. The “type” attribute specifies the data type for the column.An example of a UI Definition fragment for a tree store:
<object class="GtkTreeStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> </columns> </object>
- classmethod new(types)[source]¶
- Parameters:
types ([
GObject.GType]) – an array ofGObject.GTypetypes for the columns, from first to last- Returns:
a new
Gtk.TreeStore- Return type:
Non vararg creation function. Used primarily by language bindings.
- append(parent, row=None)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonerow ([
object] orNone) – a list of values to apply to the newly inserted row orNone
- Returns:
obj:Gtk.TreeIter pointing to the inserted row
- Return type:
Appends a new row to self. If parent is not
None, then it will append the new row after the last child of parent, otherwise it will append a row to the top level.The returned iterator will point to the new row. The row will be empty after this function is called if row is
None. To fill in values, you need to callGtk.TreeStore.set() orGtk.TreeStore.set_value().If row isn’t
Noneit has to be a list of values which will be used to fill the row.
- insert(parent, position, row=None)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNoneposition (
int) – position to insert the new row, or -1 for lastrow ([
object] orNone) – a list of values to apply to the newly inserted row orNone
- Returns:
a
Gtk.TreeIterpointing to the new row- Return type:
Creates a new row at position. If parent is not
None, then the row will be made a child of parent. Otherwise, the row will be created at the toplevel. If position is -1 or is larger than the number of rows at that level, then the new row will be inserted to the end of the list.The returned iterator will point to the newly inserted row. The row will be empty after this function is called if row is
None. To fill in values, you need to callGtk.TreeStore.set() orGtk.TreeStore.set_value().If row isn’t
Noneit has to be a list of values which will be used to fill the row.
- insert_after(parent, sibling, row=None)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonesibling (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonerow ([
object] orNone) – a list of values to apply to the newly inserted row orNone
- Returns:
a
Gtk.TreeIterpointing to the new row- Return type:
Inserts a new row after sibling. If sibling is
None, then the row will be prepended to parent ‘s children. If parent and sibling areNone, then the row will be prepended to the toplevel. If both sibling and parent are set, then parent must be the parent of sibling. When sibling is set, parent is optional.The returned iterator will point to this new row. The row will be empty after this function is called if row is
None. To fill in values, you need to callGtk.TreeStore.set() orGtk.TreeStore.set_value().If row isn’t
Noneit has to be a list of values which will be used to fill the row.
- insert_before(parent, sibling, row=None)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonesibling (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonerow ([
object] orNone) – a list of values to apply to the newly inserted row orNone
- Returns:
a
Gtk.TreeIterpointing to the new row- Return type:
Inserts a new row before sibling. If sibling is
None, then the row will be appended to parent ‘s children. If parent and sibling areNone, then the row will be appended to the toplevel. If both sibling and parent are set, then parent must be the parent of sibling. When sibling is set, parent is optional.The returned iterator will point to this new row. The row will be empty after this function is called if row is
None. To fill in values, you need to callGtk.TreeStore.set() orGtk.TreeStore.set_value().If row isn’t
Noneit has to be a list of values which will be used to fill the row.
- insert_with_values(parent, position, columns, values)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNoneposition (
int) – position to insert the new row, or -1 for lastcolumns ([
int]) – an array of column numbersvalues ([
GObject.Value]) – an array of GValues
- Returns:
An unset
Gtk.TreeIterto set the new row, orNone.- Return type:
iter:
Gtk.TreeIter
A variant of
Gtk.TreeStore.insert_with_values() which takes the columns and values as two arrays, instead of varargs. This function is mainly intended for language bindings.New in version 2.10.
- is_ancestor(iter, descendant)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – A validGtk.TreeIterdescendant (
Gtk.TreeIter) – A validGtk.TreeIter
- Returns:
True, if iter is an ancestor of descendant- Return type:
Returns
Trueif iter is an ancestor of descendant. That is, iter is the parent (or grandparent or great-grandparent) of descendant.
- iter_depth(iter)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – A validGtk.TreeIter- Returns:
The depth of iter
- Return type:
Returns the depth of iter. This will be 0 for anything on the root level, 1 for anything down a level, etc.
- iter_is_valid(iter)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – AGtk.TreeIter.- Returns:
- Return type:
WARNING: This function is slow. Only use it for debugging and/or testing purposes.
Checks if the given iter is a valid iter for this
Gtk.TreeStore.New in version 2.2.
- move_after(iter, position)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – AGtk.TreeIter.position (
Gtk.TreeIterorNone) – AGtk.TreeIter.
Moves iter in self to the position after position. iter and position should be in the same level. Note that this function only works with unsorted stores. If position is
None, iter will be moved to the start of the level.New in version 2.2.
- move_before(iter, position)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – AGtk.TreeIter.position (
Gtk.TreeIterorNone) – AGtk.TreeIterorNone.
Moves iter in self to the position before position. iter and position should be in the same level. Note that this function only works with unsorted stores. If position is
None, iter will be moved to the end of the level.New in version 2.2.
- prepend(parent, row=None)[source]¶
- Parameters:
parent (
Gtk.TreeIterorNone) – A validGtk.TreeIter, orNonerow ([
object] orNone) – a list of values to apply to the newly inserted row orNone
- Returns:
obj:Gtk.TreeIter pointing to the inserted row
- Return type:
Prepends a new row to self. If parent is not
None, then it will prepend the new row before the first child of parent, otherwise it will prepend a row to the top level.The returned iterator will point to the new row. The row will be empty after this function is called if row is
None. To fill in values, you need to callGtk.TreeStore.set() orGtk.TreeStore.set_value().If row isn’t
Noneit has to be a list of values which will be used to fill the row.
- remove(iter)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – A validGtk.TreeIter- Returns:
- Return type:
Removes iter from self. After being removed, iter is set to the next valid row at that level, or invalidated if it previously pointed to the last one.
- set(iter, columns, values)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – A validGtk.TreeIterfor the row being modifiedcolumns ([
int]) – an array of column numbersvalues ([
GObject.Value]) – an array of GValues
A variant of gtk_tree_store_set_valist() which takes the columns and values as two arrays, instead of varargs. This function is mainly intended for language bindings or in case the number of columns to change is not known until run-time.
New in version 2.12.
- set_column_types(types)[source]¶
- Parameters:
types ([
GObject.GType]) – An array ofGObject.GTypetypes, one for each column
This function is meant primarily for
GObject.Objectsthat inherit fromGtk.TreeStore, and should only be used when constructing a newGtk.TreeStore. It will not function after a row has been added, or a method on theGtk.TreeModelinterface is called.
- set_value(treeiter, column, value)[source]¶
- Parameters:
iter (
Gtk.TreeIter) – A validGtk.TreeIterfor the row being modifiedcolumn (
int) – column number to modifyvalue (
GObject.Value) – new value for the cell
Sets the data in the cell specified by iter and column. The type of value must be convertible to the type of the column.
value can also be a Python value and will be converted to a
GObject.Valueusing the corresponding column type (SeeGtk.ListStore.set_column_types()).
- swap(a, b)[source]¶
- Parameters:
a (
Gtk.TreeIter) – AGtk.TreeIter.b (
Gtk.TreeIter) – AnotherGtk.TreeIter.
Swaps a and b in the same level of self. Note that this function only works with unsorted stores.
New in version 2.2.