A Seg, 2003-10-20 �s 19:38, Don Allingham escreveu: > I've been trying to develop my own list model for a gtk.TreeView. The ListStore's > performance is significantly slower that I can accept (I have thousands of entries, > and it can take longer than a minute to load). I've been able to create my own class > derived from gtk.GenericTreeModel, and it has proved to be at least an order of > magnitude faster. The problem I am encountering is that I cannot figure out how > to add column sorting. All the examples I've been able to find are static (data is > never added or deleted) and non-sortable > > If I make a column sortable on the TreeView (column.set_sort_column_id(0)), and it > is clicked, I get the error: > > (model.py:16538): Gtk-CRITICAL **: file gtktreesortable.c: line 107 > (gtk_tree_sortable_get_sort_column_id): assertion `GTK_IS_TREE_SORTABLE (sortable)' > failed > > The class, derived from GenericTreeModel, does not have the set_sort_column_id() > method that the TreeStore and ListStore classes have. This method is a member of > the TreeSortable class, which GenericTreeModel is not derived from > > I've tried to make my class inherit from the gtk.TreeSortable class (similar to the > TreeStore class): > > class MyTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): > > And I get the error: > > Traceback (most recent call last): > File "model.py", line 6, in ? > class MyTreeModel(gtk.GenericTreeModel,gtk.TreeSortable): > TypeError: multiple bases have instance lay-out conflict > > I think I am missing something pretty basic here. Does anyone know what I am > doing wrong?
You should try keeping your tree model intact, then create a gtk.TreeModelSort object, wrapping your model, then use the gtk.TreeModelSort as model for the tree view. See this: http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtktreemodelsort.html > > Thanks, > Don Allingham > > > > _______________________________________________ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
