Seltzer wrote: > Hi, > I have a tree view which contains a list of media items to be played, > and > some information about them. > I would like to be able to let the user re-order this list, but if i just > use "set_reorderable(True)" than they can actually > drop one item onto another, and make the dropped item the child of the > item > it was dropped onto. I need to disable this some how, so that you can > reorder the list, but not not drop one item into the other, just re > arrange them. > I am also restricted by pygtk version 2.4 > > thanks for the help, > felix.
You can define a drag_motion handler in which you detect drop position with INTO (i.e., TREE_VIEW_DROP_INTO_OR_{AFTER,BEFORE}) and then invalidate the position by calling the enable_model_drag_dest method with a bogus target. def on_drag_motion(self, treeview, drag_context, x, y, timestamp): dest_row = treeview.get_dest_row_at_pos(int(x), int(y)) if dest_row is not None: path, drop = dest_row if drop in (gtk.TREE_VIEW_DROP_INTO_OR_AFTER, gtk.TREE_VIEW_DROP_INTO_OR_BEFORE): self.view['queue_treeview'].enable_model_drag_dest( [('invalid-position', 0, -1)], gtk.gdk.ACTION_DEFAULT) else: {enable model drag dest with valid target} -- Jeffrey Barish _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/