GNOME Bugzilla – Bug 609000
Treeviews with gtk.CellRendererToggle can't be reordered.
Last modified: 2018-02-10 03:27:56 UTC
The following code reproduces the problem: import gtk class ListDisp: def __init__(self): self.w = gtk.Dialog() self.store=gtk.ListStore('gboolean',str) self.view=gtk.TreeView() self.w.vbox.add(self.view) self.view.set_model(self.store) self.tvcolumn = gtk.TreeViewColumn('File Name') self.view.append_column(self.tvcolumn) self.cell = gtk.CellRendererText() self.toggle=gtk.CellRendererToggle() self.tvcolumn.pack_start(self.cell, True) self.tvcolumn.pack_start(self.toggle, True) self.tvcolumn.add_attribute(self.cell, 'text', 1) self.view.set_reorderable(True) self.store.append([True,"foo"]) self.store.append([True,"goo"]) if __name__ == "__main__": ld=ListDisp() ld.w.show_all() ld.w.run() rows can't be reordered via drag and drop; if you comment the line " self.tvcolumn.pack_start(self.toggle, True)", then they can.
I forgot to mention that the fact that it is a gtk+ bug is a gues: I don't think it was introduced by pygtk bindings, but I didn't test in a C program.
Looks like it is indeed specific to CellRendererToggle. When I put the toggle in a second TreeViewColumn, DnD functions correctly for the first column: import gtk class ListDisp(gtk.Window): def __init__(self): gtk.Window.__init__(self) self.vbox = gtk.VBox() self.add(self.vbox) self.store=gtk.ListStore('gboolean',str) self.store.append([True,"foo"]) self.store.append([True,"goo"]) self.view=gtk.TreeView(self.store) self.view.set_reorderable(True) self.tvcolumn = gtk.TreeViewColumn('File Name') self.view.append_column(self.tvcolumn) self.cell = gtk.CellRendererText() self.tvcolumn.pack_start(self.cell, True) self.tvcolumn.add_attribute(self.cell, 'text', 1) self.tvcolumn2 = gtk.TreeViewColumn('Toggle') self.view.append_column(self.tvcolumn2) self.toggle=gtk.CellRendererToggle() self.tvcolumn2.pack_start(self.toggle, True) self.vbox.pack_start(self.view) self.show_all() if __name__ == "__main__": ld=ListDisp() gtk.main()
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.