Re: GtkTreeModelFilter and GtkTreeSortable
- From: Matías Alejandro Torres <torresmat gmail com>
- To: Kristian Rietveld <kris imendio com>
- Cc: gtk-app-devel-list gnome org, Andrew Cowie <andrew operationaldynamics com>
- Subject: Re: GtkTreeModelFilter and GtkTreeSortable
- Date: Wed, 10 Oct 2007 19:38:22 -0300
Kristian Rietveld escribió:
See the API documentation here:
http://pygtk.org/docs/pygtk/class-gtktreemodelsort.html
To the constructor of gtk.TreeModelSort you want to pass in self.filter
as child model. Then set the resulting "sort model" as model to show in
the tree view.
regards,
-kris.
You want to wrap the GtkTreeModelFilter you create here in a
Hi again,
I did what you told me, it worked, but I have a few questions:
- I have to create a new GtkTreeModelSort everytime the child model is
modified? or it gets resorted automatically? Example:
fiter = self.sortedModel.convert_iter_to_child_iter (None, siter)
miter = self.filter.convert_iter_to_child_iter (fiter)
self.model.remove (miter)
self.filter.refilter ()
self.sortedModel = gtk.TreeModelSort (self.filter)
self.sortedModel.set_sort_func
(gui.patientsmodel.PATIENT_OBJECT_COLUMN,
gui.patientsmodel.patient_sort_func)
self.sortedModel.set_sort_column_id
(gui.patientsmodel.PATIENT_OBJECT_COLUMN, gtk.SORT_ASCENDING)
tv.set_model (self.sortedModel)
- About efficiency, everytime I set's the sortedModel to the GtkTreeView
it takes a few seconds (like 2 secs) to display it. It takes about the
same with both ways, recreating the sortedModel again and ... well...
not recreating it (but I don't know if I can do this). There's about
2.000 rows in the model, is this normal? Suggestions?
thanks, Matias.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]