[Sugar-devel] [PATCH Paint] Add cursor for the picker tool #3496

Manuel Quiñones manuq at laptop.org
Thu Apr 26 08:41:48 EDT 2012


Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
 Area.py           |   18 +++++++++++++-----
 images/picker.png |  Bin 0 -> 977 bytes
 2 files changed, 13 insertions(+), 5 deletions(-)
 create mode 100644 images/picker.png

diff --git a/Area.py b/Area.py
index 24f02d4..aae3d78 100644
--- a/Area.py
+++ b/Area.py
@@ -1403,14 +1403,22 @@ class Area(gtk.DrawingArea):
                 cursor = gtk.gdk.cursor_new_from_name(display, name)
             elif self.tool['name'] == 'marquee-rectangular':
                 cursor = gtk.gdk.Cursor(gtk.gdk.CROSS)
-            elif self.tool['name'] == 'stamp':
-                filename = os.path.join('images', 'stamp.png')
-                pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
-                cursor = gtk.gdk.Cursor(display, pixbuf, 20, 38)
             else:
                 filename = os.path.join('images', self.tool['name'] + '.png')
                 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
-                cursor = gtk.gdk.Cursor(display, pixbuf, 0, 0)
+
+                # Decide which is the cursor hot spot offset:
+                if self.tool['name'] == 'stamp':
+                    hotspot_x, hotspot_y  = 20, 38  # horizontal
+                                                    # center and
+                                                    # bottom
+                elif self.tool['name'] == 'picker':
+                    hotspot_x, hotspot_y  = 1, 38  # bottom left
+                                                   # corner
+                else:
+                    hotspot_x, hotspot_y  = 0, 0
+
+                cursor = gtk.gdk.Cursor(display, pixbuf, hotspot_x, hotspot_y)
         except gobject.GError:
             cursor = None
         self.window.set_cursor(cursor)
diff --git a/images/picker.png b/images/picker.png
new file mode 100644
index 0000000000000000000000000000000000000000..9ca1eebce6ac7c3b688c22aa0bf19641580f8046
GIT binary patch
literal 977
zcmV;?11|iDP)<h;3K|Lk000e1NJLTq001Wd001Wl1^@s6jH6LC00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?pe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