From db17f70e556b321f71ffe0f54e18c7bbb16f871b Mon Sep 17 00:00:00 2001 From: Valentin Valls Date: Wed, 19 May 2021 16:08:22 +0200 Subject: [PATCH 1/2] Make sure setting the style override the cached colormap --- bliss/flint/helper/model_helper.py | 14 -------------- bliss/flint/model/plot_item_model.py | 17 +++++++++++++++++ bliss/flint/widgets/scatter_plot.py | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/bliss/flint/helper/model_helper.py b/bliss/flint/helper/model_helper.py index f5830fa3f5..74230efff1 100755 --- a/bliss/flint/helper/model_helper.py +++ b/bliss/flint/helper/model_helper.py @@ -570,20 +570,6 @@ def getFastChannel( return None -def getColormapWithItemStyle( - item: plot_model.Item, - style: style_model.Style, - defaultColormap: Optional[colors.Colormap] = None, -) -> colors.Colormap: - """Returns the provided colormap updated with the item style preferences - """ - if defaultColormap is not None: - if style is not None: - defaultColormap.setName(style.colormapLut) - - return defaultColormap - - def getColormapFromItem( item: plot_model.Item, style: style_model.Style, diff --git a/bliss/flint/model/plot_item_model.py b/bliss/flint/model/plot_item_model.py index ae282b4415..94ce764f5b 100755 --- a/bliss/flint/model/plot_item_model.py +++ b/bliss/flint/model/plot_item_model.py @@ -25,6 +25,7 @@ import numpy from . import scan_model from . import plot_model +from . import style_model class ScalarPlot(plot_model.Plot): @@ -403,6 +404,14 @@ class ImageItem(plot_model.Item): self.__image = channel self._emitValueChanged(plot_model.ChangeEventType.IMAGE_CHANNEL) + def setCustomStyle(self, style: style_model.Style): + result = super(ImageItem, self).setCustomStyle(style) + if self.__colormap is not None: + # Make sure the cache is updated + if style.colormapLut is not None: + self.__colormap.setName(style.colormapLut) + return result + def colormap(self): return self.__colormap @@ -574,6 +583,14 @@ class ScatterItem(plot_model.Item): array = channel.array(scan) return array + def setCustomStyle(self, style: style_model.Style): + result = super(ScatterItem, self).setCustomStyle(style) + if self.__colormap is not None: + # Make sure the cache is updated + if style.colormapLut is not None: + self.__colormap.setName(style.colormapLut) + return result + def colormap(self): return self.__colormap diff --git a/bliss/flint/widgets/scatter_plot.py b/bliss/flint/widgets/scatter_plot.py index 1c31aa68bf..bb62b52eb2 100755 --- a/bliss/flint/widgets/scatter_plot.py +++ b/bliss/flint/widgets/scatter_plot.py @@ -947,7 +947,7 @@ class ScatterPlotWidget(plot_helper.PlotWidget): legend = valueChannel.name() style = item.getStyle(scan) - colormap = model_helper.getColormapWithItemStyle(item, style, self.__colormap) + colormap = model_helper.getColormapFromItem(item, style, self.__colormap) scatter = None curve = None -- GitLab From b2e133ba00b187e6e7e6cf3fefdb00c3263c12a2 Mon Sep 17 00:00:00 2001 From: Valentin Valls Date: Wed, 19 May 2021 16:11:24 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 386e28a2c6..a65776dc49 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed blinking of the regulation plot legend - Fixed undisplayed ROIs during a scan. A tool is provided to display them if not already selected. - - Fix update of the property view after an update of the backend + - Fixed update of the property view after an update of the backend + - Fixed colormap LUT of the scatter plot when it is set with the style dialog ### Removed -- GitLab