[PATCH] fix #813 problem with clipboard , OLPC #9022 also

Gonzalo Odiard godiard at gmail.com
Sat Jun 12 17:08:08 EDT 2010


This resolves pasting of a image from Browse to Paint or inside Paint
Not resolves draging one image from the frame to Paint
---
 Area.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Area.py b/Area.py
index 7b921b8..8340d50 100644
--- a/Area.py
+++ b/Area.py
@@ -69,6 +69,7 @@ import math
 import pango
 from fill import *
 from Desenho import Desenho
+from urlparse import urlparse

 ##Tools and events manipulation are handle with this class.
 class Area(gtk.DrawingArea):
@@ -741,6 +742,11 @@ class Area(gtk.DrawingArea):
             self.tool['name'] = 'marquee-rectangular'
             self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR))
             self.emit('select')
+        elif clipBoard.wait_is_uris_available():
+            selection = clipBoard.wait_for_contents('text/uri-list')
+            if selection != None:
+                for uri in selection.get_uris():
+                    self.loadImage(urlparse(uri).path, self)
         else:
             self.loadImage(tempPath, self)
             logging.debug('Area.past(self): Load from clipboard fails,
loading from tempPatch')
-- 
1.6.6.1

--000e0cd4cfda2f94760488dbdbca
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable



More information about the Sugar-devel mailing list