[pygtk] Treeview, nautilus and drag and drop to reorder.
Rob Brown-Bayliss
r.brown.bayliss at gmail.com
Sat Mar 14 17:52:46 WST 2009
On Sat, 2009-03-14 at 03:20 -0500, alex goretoy wrote:
> I would track certain evens and recreate the tree view with the list
> after drop or after press, code is good
> -Alex Goretoy
> http://www.goretoy.com
The problem is if I do this:
self.maps_treeview.drag_source_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.maps_treeview.drag_dest_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.maps_treeview.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
[("Reorder", gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
#self.maps_treeview.enable_model_drag_dest([("Reorder",
gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
I can drag and drop from Nautilis, and add the files to the liststore
model. But I can't drag and drop within the tree view to reorder lines
because the enable_model_drag_dest() is commented out.
If I uncomment that last line, then I can't drag and drop files from
nautilus onto the treeview.
Now for the interesting bit. I thought I had it working, and in a way
I did.
If I comment out the third line like so:
self.maps_treeview.drag_source_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.maps_treeview.drag_dest_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
#self.maps_treeview.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
[("Reorder", gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
self.maps_treeview.enable_model_drag_dest([("Reorder",
gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
It also fails to accept drag and drop from nautilus, but if I uncomment
the line and miss spell the widget like so:
self.maps_treeview.drag_source_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.maps_treeview.drag_dest_set(gtk.DEST_DEFAULT_ALL,
target[:-1],gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
NO_SUCH_WIDGET = None
NO_SUCH_WIDGET.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
[("Reorder", gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
self.maps_treeview.enable_model_drag_dest([("Reorder",
gtk.TARGET_SAME_WIDGET, 0)], gtk.gdk.ACTION_COPY)
I can drag and drop from nautilus, and drag and drop to reorder the
lines, but obviously that is not the correct solution. And just for
fun, if I comment out the NO_SUCH_WIDGET.enable_model_drag_source() line
once again I can't drag and drop from nautilus.
I am using python and pygtk as standard on ubuntu 8.10
Any ideas?
--
Rob Brown-Bayliss <r.brown.bayliss at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090314/7a9906f4/attachment.htm
More information about the pygtk
mailing list