Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Area.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-05-02 11:49:21 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-05-04 16:51:08 (GMT)
commitcc044ab4fa08b8e0e143f251ef634322e4f81b40 (patch)
tree7125d372c406435acfb1c14a91f574ba971aeead /Area.py
parentac25ef327ad2ca416ec4824be72dd29a8287968b (diff)
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 <humitos@gmail.com>
Diffstat (limited to 'Area.py')
-rw-r--r--Area.py11
1 files changed, 10 insertions, 1 deletions
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']