From cc044ab4fa08b8e0e143f251ef634322e4f81b40 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 02 May 2012 11:49:21 +0000 Subject: Avoid using numpy 1.6.1 in invert_colors function There is a bug (or something like that) in numpy 1.6.1 that makes invert_color to not work properly. So, now we are checking for this version and if it's found we use the string implementation of this funcion instead. Signed-off-by: Manuel Kaufmann --- (limited to 'Area.py') diff --git a/Area.py b/Area.py index 50c0744..b889974 100644 --- a/Area.py +++ b/Area.py @@ -1038,13 +1038,22 @@ class Area(gtk.DrawingArea): def proc_invert_color(temp_pix): try: import numpy + # HACK: This numpy version has a bug and breaks the + # 'invert_color' function + # http://bugs.sugarlabs.org/ticket/3509 + if numpy.__version__ == '1.6.1': + logging.warning('You have installed a version of numpy ' + '(1.6.1) that has a bug and can\'t be ' + 'used. Using string module instead ' + '(slower)') + raise ImportWarning pix_manip2 = temp_pix.get_pixels_array() pix_manip = numpy.ones(pix_manip2.shape, dtype=numpy.uint8) \ * 255 pix_manip2 = pix_manip - pix_manip2 temp_pix = gtk.gdk.pixbuf_new_from_array(pix_manip2, gtk.gdk.COLORSPACE_RGB, 8) - except: + except (ImportError, ImportWarning): import string a = temp_pix.get_pixels() b = len(a) * ['\0'] -- cgit v0.9.1