[pygtk] Treeview does not re-sort automatically

Andreas Sommer AndiDog at web.de
Tue Jul 21 17:46:02 WST 2009


Hi list, I'm having a problem with a TreeView not getting-resorted:

My model was created like this:

model = gtk.TreeStore(object)

and I have set a sort column id for each column. The "object" is a class 
which contains all information needed by the columns - column data is 
retrieved via functions that access this class (set via set_cell_data_func).
Every 2 seconds, I update all rows and emit the "row_changed" signal 
like so:

model.row_changed(row.path, row.iter)

But then, the treeview does not sort itself again even if I call 
model.sort_column_changed() after making all changes. My user-defined 
sort function doesn't even get called in that case.

Only with changing forth and back

model.set_sort_column_id(1, gtk.SORT_ASCENDING)
model.set_sort_column_id(0, gtk.SORT_ASCENDING)

or if I click on the column header, the treeview gets re-sorted 
immediately. Of course, this can't be the solution ;-)

I could imagine that the problem is that I only have the "object" in the 
TreeStore, which of course never changes.

Is there a good solution??

/Best regards
    Andreas
/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090721/b40fe8d6/attachment.htm 


More information about the pygtk mailing list