summaryrefslogtreecommitdiff
path: root/silx/gui/plot3d/_model/items.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot3d/_model/items.py')
-rw-r--r--silx/gui/plot3d/_model/items.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/silx/gui/plot3d/_model/items.py b/silx/gui/plot3d/_model/items.py
index 7009ea1..02485fe 100644
--- a/silx/gui/plot3d/_model/items.py
+++ b/silx/gui/plot3d/_model/items.py
@@ -30,18 +30,19 @@ from __future__ import absolute_import, division
__authors__ = ["T. Vincent"]
__license__ = "MIT"
-__date__ = "11/01/2018"
+__date__ = "24/04/2018"
import functools
+import logging
import weakref
import numpy
from silx.third_party import six
-from ..._utils import convertArrayToQImage
-from ...plot.Colormap import preferredColormaps
+from ...utils._image import convertArrayToQImage
+from ...colors import preferredColormaps
from ... import qt, icons
from .. import items
from ..items.volume import Isosurface, CutPlane
@@ -50,6 +51,9 @@ from ..items.volume import Isosurface, CutPlane
from .core import AngleDegreeRow, BaseRow, ColorProxyRow, ProxyRow, StaticRow
+_logger = logging.getLogger(__name__)
+
+
class _DirectionalLightProxy(qt.QObject):
"""Proxy to handle directional light with angles rather than vector.
"""
@@ -472,7 +476,11 @@ class DataItem3DTransformRow(StaticRow):
"""
item = self.item()
if item is not None:
- item.setScale(scale.x(), scale.y(), scale.z())
+ sx, sy, sz = scale.x(), scale.y(), scale.z()
+ if sx == 0. or sy == 0. or sz == 0.:
+ _logger.warning('Cannot set scale to 0: ignored')
+ else:
+ item.setScale(scale.x(), scale.y(), scale.z())
class GroupItemRow(Item3DRow):
@@ -519,7 +527,7 @@ class GroupItemRow(Item3DRow):
# Find item
for row in self.children():
- if row.item() is item:
+ if isinstance(row, Item3DRow) and row.item() is item:
self.removeRow(row)
break # Got it
else:
@@ -764,7 +772,7 @@ class ColormapRow(_ColormapBaseProxyRow):
def _getName(self):
"""Proxy for :meth:`Colormap.getName`"""
- if self._colormap is not None:
+ if self._colormap is not None and self._colormap.getName() is not None:
return self._colormap.getName().title()
else:
return ''