>From 857fcf33ac6ca61ca097b23394eccc9025ee8575 Mon Sep 17 00:00:00 2001<br>From: Gonzalo Odiard &lt;<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>&gt;<br>Date: Sun, 13 Jun 2010 21:25:43 -0300<br>Subject: [PATCH] fix olpc #8229 - Cannot drag image from clipboard<br>
<br>---<br> Area.py |   15 +++++++++++++++<br> 1 files changed, 15 insertions(+), 0 deletions(-)<br><br>diff --git a/Area.py b/Area.py<br>index 8340d50..ff9a29b 100644<br>--- a/Area.py<br>+++ b/Area.py<br>@@ -72,6 +72,9 @@ from Desenho import Desenho<br>
 from urlparse import urlparse<br> <br> ##Tools and events manipulation are handle with this class.<br>+<br>+TARGET_URI = 0<br>+<br> class Area(gtk.DrawingArea):<br> <br> <br>@@ -110,6 +113,11 @@ class Area(gtk.DrawingArea):<br>
         self.connect(&quot;leave_notify_event&quot;, self.mouseleave)<br>         self.connect(&quot;enter_notify_event&quot;, self.mouseenter)<br> <br>+        target = [(&#39;text/uri-list&#39;, 0, TARGET_URI)]<br>+        self.drag_dest_set(gtk.DEST_DEFAULT_ALL, target,<br>
+                gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)<br>+        self.connect(&#39;drag_data_received&#39;, self.drag_data_received)<br>+<br>         self.set_flags(gtk.CAN_FOCUS)<br>         self.grab_focus()<br> <br>
@@ -709,6 +717,13 @@ class Area(gtk.DrawingArea):<br>                 os.remove( data )<br>         data = None<br>            <br>+    def drag_data_received(self, w, context, x, y, data, info, time):<br>+        if data and data.format == 8:<br>
+            self.loadImage(urlparse(data.data).path, self)<br>+            context.finish(True, False, time)<br>+        else:<br>+            context.finish(False, False, time)<br>+<br>     def past(self,widget):<br>         &quot;&quot;&quot; Past image.<br>
         Past image that is in pixmap<br>-- <br>1.6.6.1<br><br clear="all"><br>-- <br>Gonzalo Odiard<br>Responsable de Desarrollo<br>Sistemas Australes<br><br>