I'm trying to drag data (a filename) from a GtkTreeView, but I cannot
get the data to the drop target. I have created a GtkTreeView thusly
(the columns, stores, and GtkCellRenderText objects are also created).
view = gtk.TreeView(store)
target = [('text/uri-list', 0, 0)]
view.drag_source_set(gtk.gdk.BUTTON1_MASK, target,
gtk.gdk.ACTION_COPY)
view.connect("drag-data-get", on_drag_data_get)
And my "drag-data-get" callback looks like the following.
def on_drag_data_get(treeView, dragContext, selectionData,
info, dragTime):
selection = treeView.get_selection()
store, iter = selection.get_selected()
filename = store.get_value(iter, 0)
selectionData.set_text(filename, -1)
print selectionData.get_text()
Unfortunately the target gets no data. The "print" at the bottom of the
callback always displays "None", even though the statement above sets
it. Any ideas what I'm doing wrong? I suspect I should be doing
something else with the GtkSelectionData, but I have no idea what :(
Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
>>> gtk.pygtk_version
(1, 99, 12)
--
Michael JasonSmith http://www.cosc.canterbury.ac.nz/~mpj17/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/