[PATCH] fix olpc #8229 - Cannot drag image from clipboard
Gonzalo Odiard
godiard at gmail.com
Sun Jun 13 20:25:43 EDT 2010
---
Area.py | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/Area.py b/Area.py
index 8340d50..ff9a29b 100644
--- a/Area.py
+++ b/Area.py
@@ -72,6 +72,9 @@ from Desenho import Desenho
from urlparse import urlparse
##Tools and events manipulation are handle with this class.
+
+TARGET_URI = 0
+
class Area(gtk.DrawingArea):
@@ -110,6 +113,11 @@ class Area(gtk.DrawingArea):
self.connect("leave_notify_event", self.mouseleave)
self.connect("enter_notify_event", self.mouseenter)
+ target = [('text/uri-list', 0, TARGET_URI)]
+ self.drag_dest_set(gtk.DEST_DEFAULT_ALL, target,
+ gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
+ self.connect('drag_data_received', self.drag_data_received)
+
self.set_flags(gtk.CAN_FOCUS)
self.grab_focus()
@@ -709,6 +717,13 @@ class Area(gtk.DrawingArea):
os.remove( data )
data = None
+ def drag_data_received(self, w, context, x, y, data, info, time):
+ if data and data.format == 8:
+ self.loadImage(urlparse(data.data).path, self)
+ context.finish(True, False, time)
+ else:
+ context.finish(False, False, time)
+
def past(self,widget):
""" Past image.
Past image that is in pixmap
--
1.6.6.1
--
Gonzalo Odiard
Responsable de Desarrollo
Sistemas Australes
--000e0cd4d328871fda0488f29d7b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
More information about the Sugar-devel
mailing list