>From 857fcf33ac6ca61ca097b23394eccc9025ee8575 Mon Sep 17 00:00:00 2001<br>From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>><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("leave_notify_event", self.mouseleave)<br> self.connect("enter_notify_event", self.mouseenter)<br> <br>+ target = [('text/uri-list', 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('drag_data_received', 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> """ 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>