Don Allingham wrote:

I've been experimenting with the TreeModelFilter class, and I've noticed
something really odd. Hopefully, its due to my misunderstanding of the
class.

When I modify a model to create a filtered model, I seem to lose the top
level nodes, and what appears as the top level nodes only have the
children of the first node.

I've seen this with my own models, and with the treemodel.py shipped
with pygtk as an example.

If I modify the treemodel.py file from:

model = MyTreeModel()

to:

model = MyTreeModel().filter_new(0)

This creates a model starting from the virtual root of zero i.e. the tree only contains the children of node 0. Pass it None or leave it out to use all the nodes. That doesn't work with your example because it doesn't follow the treemodel interface - iter_n_children should handle node=None as meaning retrieve the number of toplevel nodes:

http://www.pygtk.org/pygtk2reference/class-gtktreemodel.html#method-gtktreemodel--iter-n-children

John

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to