gtk.GenericTreeModel — a TreeView model that helps create tree models in Python
class gtk.GenericTreeModel(gobject.GObject, gtk.TreeModel): |
|
The gtk.GenericTreeModel helps in the creation of gtk.TreeView tree models in Python. The gtk.GenericTreeModel is subclassed to provide a new tree model that provides the tree model behavior using methods with predefined names that are called by the gtk.GenericTreeModel methods as required to provide the various tree model operations. The methods that need to be defined by the programmer in Python are:
def on_get_flags(self)
def on_get_n_columns(self)
def on_get_column_type(self, index)
def on_get_iter(self, path)
def on_get_path(self, rowref)
def on_get_value(self, rowref, column)
def on_iter_next(self, rowref)
def on_iter_children(self, parent)
def on_iter_has_child(self, rowref)
def on_iter_n_children(self, rowref)
def on_iter_nth_child(self, parent, n)
def on_iter_parent(self, child)
See the gtk.TreeModel description for details of the above methods.
In PyGTK 2.4 and above the invalidate_iters() and iter_is_valid() methods are available to help manage the gtk.TreeIter objects and their Python object references. These are particularly useful when the "leak-references" property is set to FALSE.
The tree models derived from gtk.GenericTreeModel are protected from problems with out of date gtk.TreeIter objects because gtk.TreeIter objects are automatically checked for validity with the tree model.
If a custom tree model doesn't support persistent iters (i.e. gtk.TREE_MODEL_ITERS_PERSIST is not set in the return from the gtk.TreeModel.get_flags() method), it can call the invalidate_iters() method to invalidate all its outstanding gtk.TreeIter objects when it changes the model (e.g. after inserting a new row). The tree model can also dispose of any Python objects that it passed references to gtk.TreeIter objects after calling the invalidate_iters() method.
Applications can use the iter_is_valid() method to determine if a gtk.TreeIter is still valid for the custom tree model.
|
Returns : | a new gtk.GenericTreeModel object |
Creates a new gtk.GenericTreeModel object
|
This method is available in PyGTK 2.4 and above.
The invalidate_iters() method invalidates all the gtk.TreeIter objects for the custom tree model.
|
iter : | a gtk.TreeIter |
Returns : | TRUE if iter is valid for the tree model; otherwise, FALSE is returned. |
This method is available in PyGTK 2.4 and above.
The iter_is_valid() method returns TRUE if the gtk.TreeIter specified by iter is valid for the custom tree model.