diff --git a/glue_jupyter/bqplot/image/layer_artist.py b/glue_jupyter/bqplot/image/layer_artist.py index 3567d3e7..7a546872 100644 --- a/glue_jupyter/bqplot/image/layer_artist.py +++ b/glue_jupyter/bqplot/image/layer_artist.py @@ -98,7 +98,7 @@ def _update_contour_lines(self): contour_data = converter.to_unit(self.state.layer, self.state.attribute, contour_data, - self.state.c_display_unit) + self.state.attribute_display_unit) for level in self.state.levels: if level not in self._contour_line_cache: diff --git a/glue_jupyter/bqplot/image/state.py b/glue_jupyter/bqplot/image/state.py index edbf5a98..24431700 100644 --- a/glue_jupyter/bqplot/image/state.py +++ b/glue_jupyter/bqplot/image/state.py @@ -20,7 +20,6 @@ class BqplotImageViewerState(ImageViewerState): class BqplotImageLayerState(ImageLayerState): c_min = DDCProperty(docstring='The lower level used for the contours') c_max = DDCProperty(docstring='The upper level used for the contours') - c_display_unit = DDSCProperty(docstring='The units to use to display contour levels') level_mode = DDSCProperty(0, docstring='How to distribute the contour levels') n_levels = DDCProperty(5, docstring='The number of levels, in Linear mode') levels = CallbackProperty(docstring='List of values where to create the contour lines') @@ -56,17 +55,13 @@ def format_unit(unit): else: return unit - BqplotImageLayerState.c_display_unit.set_display_func(self, format_unit) - self.add_callback('n_levels', self._update_levels) self.add_callback('c_min', self._update_levels) self.add_callback('c_max', self._update_levels) self.add_callback('level_mode', self._update_levels) self.add_callback('levels', self._update_labels) - self.add_callback('attribute', self._update_c_display_unit_choices) - self.add_callback('c_display_unit', self._convert_units_c_limits, echo_old=True) + self.add_callback('attribute_display_unit', self._convert_units_c_limits, echo_old=True) - self._update_c_display_unit_choices() self._update_levels() def _update_priority(self, name): @@ -86,20 +81,6 @@ def _update_labels(self, ignore=None): # TODO: we may want to have ways to configure this in the future self.labels = ["{0:.4g}".format(level) for level in self.levels] - def _update_c_display_unit_choices(self, *args): - - if self.layer is None: - BqplotImageLayerState.c_display_unit.set_choices(self, []) - return - - component = self.layer.get_component(self.attribute) - if component.units: - c_choices = find_unit_choices([(self.layer, self.attribute, component.units)]) - else: - c_choices = [''] - BqplotImageLayerState.c_display_unit.set_choices(self, c_choices) - self.c_display_unit = component.units - def _convert_units_c_limits(self, old_unit, new_unit): if ( diff --git a/glue_jupyter/bqplot/image/tests/test_visual.py b/glue_jupyter/bqplot/image/tests/test_visual.py index 29203974..3ef57110 100644 --- a/glue_jupyter/bqplot/image/tests/test_visual.py +++ b/glue_jupyter/bqplot/image/tests/test_visual.py @@ -29,7 +29,7 @@ def test_contour_units( assert_allclose(image.state.layers[0].levels, [0.1, 0.3, 0.5, 0.7, 0.9]) - image.state.layers[0].c_display_unit = 'm' + image.state.layers[0].attribute_display_unit = 'm' assert_allclose(image.state.layers[0].levels, [100, 300, 500, 700, 900]) assert image.state.layers[0].labels == ['100', '300', '500', '700', '900'] diff --git a/setup.cfg b/setup.cfg index 74f4df05..e141b06f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,7 @@ python_requires = >=3.8 setup_requires = setuptools_scm install_requires = - glue-core>=1.17.1 + glue-core>=1.19.0 glue-vispy-viewers>=1.0 notebook>=4.0 ipympl>=0.3.0 @@ -33,7 +33,6 @@ test = pytest pytest-cov nbconvert>=6.4.5 - glue-core!=1.2.4; python_version == '3.10' visualtest = playwright pytest-playwright