Skip to content

Commit

Permalink
Merge pull request #2385 from astrofrog/fix-reference-data-update
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog authored Apr 11, 2023
2 parents 74a6827 + 5228194 commit bd257e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion glue/viewers/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ def remove_subset(self, subset):
def _add_subset(self, message):
self.add_subset(message.subset)

def _update_data_numerical(self, message):
# For some viewers, we might want to do additional things when the
# actual numerical values or shape of a dataset change, but by default
# we just pass this on to _update_data
self._update_data(message)

def _update_data(self, message):
if message.data in self._layer_artist_container:
for layer_artist in self._layer_artist_container:
Expand Down Expand Up @@ -329,7 +335,7 @@ def register_to_hub(self, hub):
filter=self._has_data_or_subset)

hub.subscribe(self, msg.NumericalDataChangedMessage,
handler=self._update_data,
handler=self._update_data_numerical,
filter=self._has_data_or_subset)

hub.subscribe(self, msg.DataCollectionDeleteMessage,
Expand Down
4 changes: 2 additions & 2 deletions glue/viewers/image/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def add_data(self, data):
self._set_wcs()
return result

def _update_data(self, *args, **kwargs):
super()._update_data(*args, **kwargs)
def _update_data_numerical(self, *args, **kwargs):
super()._update_data_numerical(*args, **kwargs)
self.state._reference_data_changed(force=True)

def _on_slice_change(self, event=None):
Expand Down

0 comments on commit bd257e5

Please sign in to comment.