Skip to content

Commit 12f0b30

Browse files
committed
Increase priority of callback for attribute_display_unit and ensure we don't try and convert None values
1 parent 1981b68 commit 12f0b30

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

glue/core/state_objects.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@ def update_values(self, force=False, use_default_modifiers=False, **properties):
332332

333333
self._previous_units = display_units
334334

335-
if set(properties) == {'display_units'}:
335+
if (
336+
set(properties) == {'display_units'} and
337+
self.lower is not None and
338+
self.upper is not None
339+
):
336340

337341
converter = UnitConverter()
338342

glue/viewers/image/state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,7 @@ def format_unit(unit):
536536

537537
ImageLayerState.attribute_display_unit.set_display_func(self, format_unit)
538538

539-
self.add_callback('attribute', self._update_attribute_display_unit_choices)
540-
# self.add_callback('attribute_display_unit', self._convert_attribute_limits_units, echo_old=True)
539+
self.add_callback('attribute', self._update_attribute_display_unit_choices, priority=10000)
541540

542541
self._update_attribute_display_unit_choices()
543542

0 commit comments

Comments
 (0)