[PATCH] use cursors from Sugar theme

James Cameron quozl at laptop.org
Wed May 26 00:36:13 EDT 2010


Use Sugar theme cursors for pencil, brush, eraser and paint-bucket.
http://dev.laptop.org/ticket/4316
---
 Area.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Area.py b/Area.py
index 611f944..8af2b9b 100644
--- a/Area.py
+++ b/Area.py
@@ -1057,8 +1057,18 @@ class Area(gtk.DrawingArea):
         
         # Setting the cursor
         try:
-            pixbuf = gtk.gdk.pixbuf_new_from_file('./images/' + tool['name'] + '.png')
-            cursor = gtk.gdk.Cursor(gtk.gdk.display_get_default() , pixbuf, 6, 21)
+            cursors = { 'pencil': 'pencil',
+                        'brush': 'paintbrush',
+                        'eraser': 'eraser',
+                        'bucket': 'paint-bucket' }
+            display = gtk.gdk.display_get_default()
+            if self.tool['name'] in cursors:
+                name = cursors[self.tool['name']]
+                cursor = gtk.gdk.cursor_new_from_name(display, name)
+            else:
+                filename = os.path.join('images', tool['name'] + '.png')
+                pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
+                cursor = gtk.gdk.Cursor(display, pixbuf, 6, 21)
         except gobject.GError:
             cursor = None
         
-- 
1.7.1


> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel


-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list