[pygtk] DND on non-editable textview
Le Boulanger Yann
asterix at lagaule.org
Thu May 11 14:45:23 WST 2006
Le Boulanger Yann wrote:
> Hi all,
>
> I'm trying to implement DND of files (from a file manager) to a textview.
> here is my code:
>
> self.TARGET_TYPE_URI_LIST = 80
> tv.connect('drag_data_received', self.on_drag_data_received)
> tv.drag_dest_set(gtk.DEST_DEFAULT_ALL,
> [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ],
> gtk.gdk.ACTION_COPY)
>
> def on_drag_data_received(self, widget, context, x, y, selection,
> target_type, timestamp):
> print 'data received'
> context.finish(True, False, timestamp)
> return True
>
> everything works fine when textview is editable, but when it's not
> editable (tv.set_editable(False)) on_drag_data_received() is not called.
> Is it normal ? is there a way to workaround that ?
>
> thanks,
> Yann
Here is a small exemple that shows the problem. run the attached
program, DND a file from a file manager (nautilus, xffm, ...) to the
text view: all is ok.
now uncomment line "tv.set_editable(False)" and restart the program:
that doesn't work anymore :(
any idea ?
Do I do something wrong ?
--
Yann
-------------- section suivante --------------
Une pi?ce jointe non texte a ?t? nettoy?e...
Nom: dnd_textview.py
Type: text/x-python
Taille: 553 octets
Desc: non disponible
Url: http://www.daa.com.au/pipermail/pygtk/attachments/20060511/eac15f3f/dnd_textview.py
More information about the pygtk
mailing list