Select a child row in a TreeView. Collapse the parent. Expand the parent. The child is no longer selected. As illustrated in the attached program, the child row was deselected immediately on clicking the expander to collapse the parent -- even before the collapse signal was emitted. Is this the behavior that we should expect? I expected that collapse/expand would have no impact on selection. Moreover, I think that GTK used to work that way. Regardless, I am wondering whether the current behavior is correct or a bug. On my system, gtk.ver is (2, 21, 5) and gobject.glib_version is (2, 26, 1).
------------------------------------ """Select a child, collapse the parent, expand the parent: the child is no longer selected.""" import gtk class SelectChildTestApp(object): def __init__(self): self.window = gtk.Window() self.window.set_size_request(200, -1) self.window.connect("destroy", gtk.main_quit) treestore = gtk.TreeStore(str) treeview = gtk.TreeView(treestore) cell = gtk.CellRendererText() col = gtk.TreeViewColumn('Text', cell, text=0) treeview.append_column(col) treeview.connect('row_collapsed', self.on_collapsed) treesel = treeview.get_selection() treesel.connect('changed', self.on_changed) for i in range(5): treeiter = treestore.append(None, ["Row %d" % i]) for j in range(3): treestore.append(treeiter, ["Subrow (%d, %d)" % (i, j)]) treestore.append(None, ["Row %d" % (i + 1)]) self.window.add(treeview) self.window.show_all() def on_changed(self, treesel): model, treepaths = treesel.get_selected_rows() if treepaths: print "\nSelected row:", treepaths else: print "\nNo row selected" def on_collapsed(self, treeview, treeiter, treepath): print "Row", treepath, "collapsed" def run(self): gtk.main() app = SelectChildTestApp() app.run() -- Jeffrey Barish _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/