GNOME Bugzilla – Bug 652235
TreeView.enable_model_drag_source() stopped working on Windows
Last modified: 2011-09-19 11:06:30 UTC
At some point, TreeView.enable_model_drag_source() stopped working on Windows. Since I only use PyGTK, I don't know if this is a general GTK+ problem or just with the Python bindings. Drag and drop doesn't work in the tutorial example on Windows with PyGTK 2.24: http://www.pygtk.org/pygtk2tutorial/examples/treeviewdnd.py However, if I change enable_model_drag_source() to drag_source_set(), drag and drop works (note: it copies the line instead of moves it, but that may be another bug or just a bad script). Note that you'll need to modify the code in treeviewdnd.py to automatically populate the liststore with some data, since interapp drag and drop doesn't seem to work on Windows, thus preventing you from populating the list manually. You can add the following to __init__ as suggested by Giuseppe Penone on the PyGTK mailing list: self.liststore.append(["line 1"]) self.liststore.append(["line 2"]) self.liststore.append(["line 3"]) self.liststore.append(["line 4"]) See the thread on the mailing list here: http://www.daa.com.au/pipermail/pygtk/2011-January/019323.html The code in Dieter link (http://git.gnome.org/browse/pygtk/tree/examples/gtk/treeview_dnd.py) works because it uses drag_source_set() and drag_dest_set() instead of TreeView.enable_model_drag_source() and TreeView.enable_model_drag_dest(). I discovered the problem not through the example linked above, but because one of my applications no longer works. I haven't run it for awhile so I don't know what version of GTK+/Pygtk broke it. I have now changed enable_model_drag_source() calls to drag_source_set() instead and it works again.
This bug affects TreeView and IconView in Python. I just know that in 2.12 it worked, and in 2.20 and later it no longer works. As stated above, drag_source_set and drag_dest_set is still working. Tested on Windows XP SP3 with Python-Gtk bundle 2.24
This is most likely related to GTK+ bug #641924, but I don't have time to properly investigate right now. In the mean time, could you try and see what happens with an updated GTK+ 2.24.5 and report back? There's a suitable gtk+-bundle here (but no updated aio installer yet): https://github.com/dieterv/legacynativebuilds/downloads Thanks, Dieter
I tested it with the gtk 2.24.5 bundle from Dieter's link. Unfortunately the behavior is unchanged; drag and drop is still not functional when using enable_model_drag_source(), but works fine with drag_source_set().
*** This bug has been marked as a duplicate of bug 616544 ***