[pygtk] Filtered Sortable

Adam Tauno Williams awilliam at whitemice.org
Fri Feb 18 19:33:39 WST 2011


On Fri, 2011-02-18 at 06:27 -0500, Adam Tauno Williams wrote: 
> On Fri, 2011-02-18 at 10:13 +0100, Timo wrote: 
> > On 17-02-11 21:08, Adam Tauno Williams wrote:
> > > I'm confused trying to make a filtered&  sorted treeview.  Filtering
> > > works... data is correctly displayed.  But sorting does not work.
> > > self.todo_model = gtk.ListStore(gobject.TYPE_PYOBJECT)
> > > # Create a TreeModelFilter to control row visibility
> > > self.todo_filter = self.todo_model.filter_new()
> > > self.todo_filter.set_visible_func(self.todo_visible_filter)
> > > # Create a TreeModelSort to wrap the TreeModelFilter
> > > self.todo_sort = gtk.TreeModelSort(self.todo_filter)
> > > # Set a sort function
> > > self.todo_sort.set_default_sort_func(TaskList.sort, None)
> > > # Set the model in the view to the TreeModelSort
> > > self.todo_task_view.set_model(self.todo_sort)
> Clicking on the header of a column other than the first column just
> results in an error of -
> GtkWarning: gtk_tree_model_sort_set_sort_column_id: assertion `header !=
> NULL' failed

Perhaps it is doing the same stupid thing as the sort call and trying to
set the column sort id on the TreeModelFilter?



More information about the pygtk mailing list