diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
commit | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (patch) | |
tree | 45d462ed36a5522e9f3b9fde6c4ec4918c2ae8e3 /silx/gui/plot/ColorBar.py | |
parent | cebdc9244c019224846cb8d2668080fe386a6adc (diff) |
New upstream version 0.10.1+dfsg
Diffstat (limited to 'silx/gui/plot/ColorBar.py')
-rw-r--r-- | silx/gui/plot/ColorBar.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/silx/gui/plot/ColorBar.py b/silx/gui/plot/ColorBar.py index fd4d34e..9798123 100644 --- a/silx/gui/plot/ColorBar.py +++ b/silx/gui/plot/ColorBar.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2018 European Synchrotron Radiation Facility +# Copyright (c) 2016-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -251,10 +251,13 @@ class ColorBarWidget(qt.QWidget): def _defaultColormapChanged(self, event): """Handle plot default colormap changed""" - if (event['event'] == 'defaultColormapChanged' and - self.getPlot().getActiveImage() is None): - # No active image, take default colormap update into account - self._syncWithDefaultColormap() + if event['event'] == 'defaultColormapChanged': + plot = self.getPlot() + if (plot is not None and + plot.getActiveImage() is None and + plot._getActiveItem(kind='scatter') is None): + # No active item, take default colormap update into account + self._syncWithDefaultColormap() def _syncWithDefaultColormap(self, data=None): """Update colorbar according to plot default colormap""" @@ -801,7 +804,7 @@ class _TickBar(qt.QWidget): if self._norm == colors.Colormap.LINEAR: return 1 - (val - self._vmin) / (self._vmax - self._vmin) elif self._norm == colors.Colormap.LOGARITHM: - return 1 - (numpy.log10(val) - numpy.log10(self._vmin)) / (numpy.log10(self._vmax) - numpy.log(self._vmin)) + return 1 - (numpy.log10(val) - numpy.log10(self._vmin)) / (numpy.log10(self._vmax) - numpy.log10(self._vmin)) else: raise ValueError('Norm is not recognized') @@ -864,7 +867,7 @@ class _TickBar(qt.QWidget): def _guessType(self, font): """Try fo find the better format to display the tick's labels - :param QFont font: the font we want want to use durint the painting + :param QFont font: the font we want to use during the painting """ form = self._getStandardFormat() @@ -873,7 +876,7 @@ class _TickBar(qt.QWidget): for tick in self.ticks: width = max(fm.width(form.format(tick)), width) - # if the length of the string are too long we are mooving to scientific + # if the length of the string are too long we are moving to scientific # display if width > _TickBar._WIDTH_DISP_VAL - _TickBar._LINE_WIDTH: return self._getScientificForm() |