summaryrefslogtreecommitdiff
path: root/silx/gui/colors.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:24 +0100
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:24 +0100
commitcebdc9244c019224846cb8d2668080fe386a6adc (patch)
treeaedec55da0f9dd4fc4d6c7eb0f58489a956e2e8c /silx/gui/colors.py
parent159ef14fb9e198bb0066ea14e6b980f065de63dd (diff)
New upstream version 0.9.0+dfsg
Diffstat (limited to 'silx/gui/colors.py')
-rw-r--r--silx/gui/colors.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/silx/gui/colors.py b/silx/gui/colors.py
index 028609b..a51bcdc 100644
--- a/silx/gui/colors.py
+++ b/silx/gui/colors.py
@@ -29,7 +29,7 @@ from __future__ import absolute_import
__authors__ = ["T. Vincent", "H.Payno"]
__license__ = "MIT"
-__date__ = "14/06/2018"
+__date__ = "05/10/2018"
from silx.gui import qt
import copy as copy_mdl
@@ -234,6 +234,8 @@ class Colormap(qt.QObject):
self._colors = None
else:
colors = numpy.array(colors, copy=False)
+ if colors.shape == ():
+ raise TypeError("An array is expected for 'colors' argument. '%s' was found." % type(colors))
colors.shape = -1, colors.shape[-1]
if colors.dtype.kind == 'f':
colors = self._convertColorsFromFloatToUint8(colors)
@@ -518,6 +520,11 @@ class Colormap(qt.QObject):
raise NotEditableError('Colormap is not editable')
name = dic['name'] if 'name' in dic else None
colors = dic['colors'] if 'colors' in dic else None
+ if name is not None and colors is not None:
+ if isinstance(colors, int):
+ # Filter out argument which was supported but never used
+ _logger.info("Unused 'colors' from colormap dictionary filterer.")
+ colors = None
vmin = dic['vmin'] if 'vmin' in dic else None
vmax = dic['vmax'] if 'vmax' in dic else None
if 'normalization' in dic: