On Wed, Oct 10, 2007 at 07:38:22PM -0300, Mat??as Alejandro Torres wrote: > - 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)
No, if you are just removing a row from the child model or inserting one in it, there is no need for creating a new sort model. The child model will "notify" the sort model about these changes and the sort model will automatically update. > - 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? Hard to give an answer here without more details. Setting a sort model that has already been connected to a filled child model on a GtkTreeView shouldn't take much time and basically be displayed instantly. If you first set the sort model on the GtkTreeView, then sort it and then fill the child model with nodes it might take a while since an expensive insertion sort will have to be done for every node that is inserted. regards, -kris. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list