Mercurial > code > home > repos > light9
changeset 1161:c99096504c79
accept drag data type 'TEXT' which i'm getting from chrome instead of text/uri-list
Ignore-this: 26f9691f227d8dfebc736cb8d8943253
author | drewp@bigasterisk.com |
---|---|
date | Sun, 15 Jun 2014 00:20:48 +0000 |
parents | b750b6109469 |
children | 487f0877b7c6 |
files | light9/editchoicegtk.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/editchoicegtk.py Sat Jun 14 23:55:46 2014 +0000 +++ b/light9/editchoicegtk.py Sun Jun 15 00:20:48 2014 +0000 @@ -47,14 +47,16 @@ def makeDropTarget(self): def ddr(widget, drag_context, x, y, selection_data, info, timestamp): - if selection_data.get_data_type().name() != 'text/uri-list': - raise ValueError("unknown DnD selection type %r" % - selection_data.get_data_type()) + dtype = selection_data.get_data_type() + if dtype.name() not in ['text/uri-list', 'TEXT']: + raise ValueError("unknown DnD selection type %r" % dtype) self.resourceObservable(URIRef(selection_data.get_data().strip())) self.currentLink.drag_dest_set( flags=Gtk.DestDefaults.ALL, - targets=[Gtk.TargetEntry.new('text/uri-list', 0, 0)], + targets=[Gtk.TargetEntry.new('text/uri-list', 0, 0), + Gtk.TargetEntry.new('TEXT', 0, 0), # getting this from chrome :( + ], actions=Gdk.DragAction.LINK | Gdk.DragAction.COPY) self.currentLink.connect("drag_data_received", ddr)