John Finlay <[EMAIL PROTECTED]> writes:

> Doug Quale wrote:
> 
> <snip many good comments>
> 
> >
> >always null.  Similarly, using SelectionData.get_text() on the
> >receiving side instead of SelectionData.data always gives me None.  Do
> >these functions work in pygtk or am I doing something wrong?
> >
> These methods work but use their own definition of "text" based on the
> target type:
> 
> STRING
> UTF8_STRING
> TEXT
> COMPOUND_TEXT
> 
> Acutally get_text() doesn't support TEXT. This is the reason that
> Thomas was having problems earlier with drag and drop between Firefox
> and gedit. TextView uses get_text() to retrieve the drag data.

Thanks John.  I remember that discussion but I wasn't alert enough to
connect it to this situation.  Thomas had entered a bug about this
very issue.  I see that Owen Taylor was aware of the problem back in
2001 and had entered bug 55117 for it
(http://bugs.gnome.org/show_bug.cgi?id=55117).

I guess this means that the target order is a lot more important than
I had realized.  Apparently UTF8_STRING is the recommended type, so
for interoperability with gtk+ applications it seems that something
like

    targets = [
        ('EXAMPLE_INTERNAL', gtk.TARGET_SAME_WIDGET, 0),
        ('UTF8_STRING', 0, 1),
        ('COMPOUND_STRING', 0, 1),
        ('STRING', 0, 1),
        ('text/plain', 0, 2),
        ]

would be advised.  Even then, set_text() and get_text() seem not very
useful if you want to be prepared to receive 'text/plain' anyway.
Owen's comments on the bug indicate that line handling for
'text/plain' isn't well specified, but I'm completely unfamiliar with
the intricacies of the X DND protocol specification.  The best source
for this stuff is http://www.freedesktop.org but I've not studied it.
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to