On 6 May 2011 18:59, Jason Heeris <[email protected]> wrote: > I have a TreeView with rows that show parameters related to a > particular object. When the user clicks the CellRendererToggle, it > sets a flag in that underlying object; when the row is double-clicked, > another dialog pops up with more detail about the object. > > The only way I've thought to do this is to keep a dict mapping paths > in the TreeModel to the objects. If there's a better way, I wouldn't > shoot it down :)
Are you writing your own TreeModel (using GenericTreeModel) or using something like TreeStore? I think you really should be using TreeIters rather than paths to manage this mapping, since they directly map to rows in the model, rather than positions in the treeview which may or may not match rows in the model. TreeStore TreeIters (and GenericTreeModel TreeIters if you're careful) are also preserved across operations like sorting the Treeview, which allows you to more flexibility in the future. Since you can trivially go from either path format to the correct TreeIter using get_iter(path), this also removes any need to worry about the path format. -- Neil Muller [email protected] I've got a gmail account. Why haven't I become cool? _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
