gtk.TreeModelSort — a tree model that is a sorted version of a child gtk.TreeModel
class gtk.TreeModelSort( |
|
A gtk.TreeModelSort
is a sorted model of its child model. A gtk.TreeModelSort
implements the gtk.TreeModel
interface and the gtk.TreeSortable
interface to manage the sort functions.
The gtk.TreeModelSort
objects support the Python mapping and iterator protocols. See the gtk.TreeModel
Description and the PyGTK
tutorial for more information.
gtk.TreeModelSort(child_model
)
| a child gtk.TreeModel |
Returns : | A new gtk.TreeModel . |
Creates a new gtk.TreeModel
,
with child_model
as the child model.
def get_model()
Returns : | the "child model" being sorted |
The get_model
() method returns the
model that the gtk.TreeModelSort
is sorting.
def convert_child_path_to_path(child_path
)
| A child tree path to convert |
Returns : | A new tree path in the treemodelsort, or
None |
The convert_child_path_to_path
() method
converts the path in the child model specified by
child_path
to a path relative to the treemodelsort.
That is, child_path
points to a path in the child
model. The returned path will point to the same row in the sorted model.
If child_path
isn't a valid path on the child model,
then None
is returned.
def convert_child_iter_to_iter(sort_iter
, child_iter
)
| None or a gtk.TreeIter for
backward compatibility. |
| A valid gtk.TreeIter
pointing to a row on the child model |
Returns : | A gtk.TreeIter
pointing to the same path in the sorted model. |
The convert_child_iter_to_iter
() method
returns a gtk.TreeIter
that
points to the row in the treemodelsort that corresponds to the row pointed
to by child_iter
. sort_iter
parameter should be None
but can specify a gtk.TreeIter
for
backward compatibility.
def convert_path_to_child_path(sorted_path
)
| a path in the sorted model |
Returns : | a new path in the child model, or
None |
The convert_path_to_child_path
() method
returns a path in the child model that refers to the same row as the path in
the sorted model specified by sorted_path
. That is,
sorted_path
points to a location in treemodelsort and
the returned path will point to the same location in the child model. If
sorted_path
does not point to a location in the child
model, None
is returned.
def convert_iter_to_child_iter(child_iter
, sorted_iter
)
| None or a gtk.TreeIter for
backward compatibility. |
| A valid gtk.TreeIter
pointing to a row on
tree_model_sort . |
Returns : | A gtk.TreeIter that
points to a row in the child model |
The convert_iter_to_child_iter
() method
returns a gtk.TreeIter
that
points to the row in the child model that is the same row pointed to by
sorted_iter
in the treemodelsort.
child_iter
should be None
but can
specify a gtk.TreeIter
for
backward compatibility.
def reset_default_sort_func()
The reset_default_sort_func
() method
resets the default sort function to be in the 'unsorted' state. That is, it
is in the same order as the child model. It will re-sort the model to be in
the same order as the child model only if the gtk.TreeModelSort
is in 'unsorted' state.
def clear_cache()
The clear_cache
() method clears the
treemodelsort of any cached iterators that haven't been reffed with the
ref_node
()
method. This might be useful if the child model being sorted is static (and
doesn't change often) and there has been a lot of unreffed access to nodes.
As a side effect of this function, all unreffed gtk.TreeIter
objects will be invalid.
def iter_is_valid(iter
)
| A gtk.TreeIter . |
Returns : | True if
iter is valid |
This method is available in PyGTK 2.2 and above.
The iter_is_valid
() method checks if
the gtk.TreeIter
specified by iter
is valid for the treemodel
sort.
This method is slow. Only use it for debugging and/or testing purposes.