gtk.TreeModelFilter — a gtk.TreeModel
which hides parts of an underlying tree (new in PyGTK 2.4)
class gtk.TreeModelFilter(gobject.GObject, gtk.TreeModel, gtk.TreeDragSource): |
|
This object is available in PyGTK 2.4 and above.
A gtk.TreeModelFilter
is a tree model which wraps another tree model, and can do the following
things:
model, iter and
user_data and returns a boolean indicating whether
the row should be filtered or not.A gtk.TreeModelFilter is
created using the gtk.TreeModel.filter_new() method. For example:
liststore = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING) modelfilter = liststore.filter_new()
The gtk.TreeModelFilter
objects support the Python mapping and iterator protocols. See the gtk.TreeModel
Description and the PyGTK
tutorial for more information.
def set_visible_func(func, data=None)
| a function called to determine the visibility of a row |
| User data to pass to
func |
This method is available in PyGTK 2.4 and above.
The set_visible_func() method sets the
visible function used when filtering the rows of the treemodel filter to the
value of func. data is the
user data that is passed to func (see below). This method will fail if the
set_visible_column()
method has already been called. The visible function signature is:
def visible_func(model, iter, user_data):
where model is the child gtk.TreeModel,
iter is a gtk.TreeIter
pointing at a row in model and user_data is the data
parameter. The function should return True if the row
should be visible.
def set_modify_func(types, func, data=None)
| a sequence containing the column types |
| a function that is called to provide the data for a specific row and column |
| user data to pass to the modify function, or
None. |
This method is available in PyGTK 2.4 and above.
The set_modify_func() method uses the
list of column types specified by types and the
function specified by func to provide a synthetic
model based on the child model of the gtk.TreeModelFilter. data
is passed to func when it is
called. func is called for each data access to return
the data which should be displayed at the location specified using the
parameters of the modify function.
The signature of func is:
def func(model,iter,column,user_data)
where model is the gtk.TreeModelFilter,
iter is a gtk.TreeIter
pointing at a row in model,
column is the column number to provide the value for
and user_data is
data. func should returns the
generated value for the specified location in
model.
This method must be called before the gtk.TreeModelFilter
is associated with a gtk.TreeView and
before either of the gtk.TreeModel.get_n_columns()
or gtk.TreeModel.get_column_type()
methods are called. Also this method can only be called once - there is no
way to change the modify function once it is set.
Since func is called for every access to
a value in model, it will be slow for models with a
large number of rows and/or columns.
def set_visible_column(column)
| the number of the column containing the visible information. |
This method is available in PyGTK 2.4 and above.
The set_visible_column() method sets
the visible column setting to the value of
column. The visible column setting contains the
number of the "child-model" column that is used to determine the visibility
of the model rows. The specified column should be a column of type
gobject.TYPE_BOOLEAN, where True means
that a row is visible, and False, not visible. This
method will fail if the set_visible_func()
method has already been called.
def get_model()Returns : | the child gtk.TreeModel |
This method is available in PyGTK 2.4 and above.
The get_model() method returns the
child gtk.TreeModel of
the treemodel filter
def convert_child_iter_to_iter(child_iter)
| A valid gtk.TreeIter
pointing to a row on the child model. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns : | a gtk.TreeIter
pointing to a row in the ol. |
Returns< |