[pygtk] Problems with gtk.TreeIter and reorderable gtk.TreeView

Damián Nohales damiannohales at gmail.com
Tue Sep 13 13:48:13 WST 2011


El 12/09/11 13:45, Jamie Bliss escribió:
 > My suggestion would bet to add a column to the store containing an
 > opaque, unique ID for each row (not unlike a database). To me, this
 > seems conceptually simpler then trying to refresh TreeIters.
 >
 > 2011/9/12 Neil Muller<drnlmuller+gtk at gmail.com>:
 >> I'm pretty sure that moving the row current_track points to will
 >> invalidate the gtk.TreeIter you have, as the row gets deleted and
 >> re-created elsewhere, which would be why you're seeing None for the
 >> path. You should be able to check if this is the case  by using
 >> ListStore.iter_is_valid().
 >
 > I was wondering the same thing, since TreeIter lifespans can be less
 > than useful in some models. But the docs (and the flags) indicate that
 > TreeIters survive changes.
 >
 > Of course, if you're right about it deleting and inserting (which you
 > probably are), it doesn't matter.

Yes, exactly, when I drag and drop the current row and check
iter_is_valid, it returns false. By the way... I'm really confused about
this behavior :S .

 >
 >> I would add some logic to the drag_data_received signal to deal with 
this case.
 >
 > Pardon my n00bishness, but isn't tree-row-drag code part of GTK and
 > not the application?

I think I'll create a method to locate the current row from a boolean
value of one of its columns...

Thanks!
Regards!


More information about the pygtk mailing list