Skip to content

Commit

Permalink
Increase priority of callback for attribute_display_unit and ensure w…
Browse files Browse the repository at this point in the history
…e don't try and convert None values
  • Loading branch information
astrofrog committed Apr 16, 2024
1 parent 1981b68 commit 12f0b30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion glue/core/state_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ def update_values(self, force=False, use_default_modifiers=False, **properties):

self._previous_units = display_units

if set(properties) == {'display_units'}:
if (
set(properties) == {'display_units'} and
self.lower is not None and
self.upper is not None
):

converter = UnitConverter()

Expand Down
3 changes: 1 addition & 2 deletions glue/viewers/image/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ def format_unit(unit):

ImageLayerState.attribute_display_unit.set_display_func(self, format_unit)

self.add_callback('attribute', self._update_attribute_display_unit_choices)
# self.add_callback('attribute_display_unit', self._convert_attribute_limits_units, echo_old=True)
self.add_callback('attribute', self._update_attribute_display_unit_choices, priority=10000)

self._update_attribute_display_unit_choices()

Expand Down

0 comments on commit 12f0b30

Please sign in to comment.