[Sugar-devel] Patch: use standard cursors in Paint
Gonzalo Odiard
godiard at gmail.com
Wed May 26 06:39:57 EDT 2010
On Wed, May 26, 2010 at 1:42 AM, James Cameron <quozl at laptop.org> wrote:
> On Tue, May 25, 2010 at 06:40:44AM -0300, Gonzalo Odiard wrote:
> > Use standard cursors for pencil, brush, eraser and paint-bucket. The
> > other tools need a custom cursor.
> > Bugs #40, #296 and OLPC #4316, #8864
>
> Reviewed and tested ...
>
> 1. does fix dev.laptop.org #4316,
>
> 2. doesn't properly fix sugarlabs.org #296, some additional tuning of
> coordinates may be needed; drawing effect still appears at an offset,
>
> 3. doesn't fix sugarlabs.org #40, in that the other cursors continue to
> be invisible against similar backgrounds,
>
> Yes, I am redrawing the images for the othr cursors.
> 4. doesn't remove images/{pencil,brush,bucket,eraser}.png
>
The coding style was a bit repetitive, here's an alternate method which
> uses a dictionary and wraps the code better:
>
> Thanks.
> From e430f2742f910d16a59318060bd39fc80e37822b Mon Sep 17 00:00:00 2001
> From: James Cameron <quozl at laptop.org>
> Date: Wed, 26 May 2010 14:36:13 +1000
> Subject: [PATCH] use cursors from Sugar theme
>
> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100526/0124e109/attachment.htm
More information about the Sugar-devel
mailing list