diff --git a/glue/core/data_collection.py b/glue/core/data_collection.py index 753b18e74..863a7baa8 100644 --- a/glue/core/data_collection.py +++ b/glue/core/data_collection.py @@ -424,7 +424,7 @@ def __setitem__(self, key, data): if not isinstance(key, str): raise TypeError("item key should be a string, but got {0}".format(type(key))) - if not isinstance(data, Data): + if not isinstance(data, BaseCartesianData): handler, preferred = data_translator.get_handler_for(data) diff --git a/glue/viewers/common/viewer.py b/glue/viewers/common/viewer.py index 86bee0391..abf48320a 100644 --- a/glue/viewers/common/viewer.py +++ b/glue/viewers/common/viewer.py @@ -39,12 +39,14 @@ class BaseViewer(HubListener): The base class for all viewers. """ - LABEL = 'Override this' + LABEL = None def __init__(self, session): self._session = session self._data = session.data_collection self._hub = None + if self.LABEL is None: + self.LABEL = str(self.__class__) def register_to_hub(self, hub): self._hub = hub diff --git a/glue/viewers/image/state.py b/glue/viewers/image/state.py index 762676aa0..0c6ae51b3 100644 --- a/glue/viewers/image/state.py +++ b/glue/viewers/image/state.py @@ -149,11 +149,11 @@ def reset_limits(self): def _display_world(self): return getattr(self.reference_data, 'coords', None) is not None - def _reference_data_changed(self, *args): + def _reference_data_changed(self, *args, force=False): # This signal can get emitted if just the choices but not the actual # reference data change, so we check here that the reference data has # actually changed - if self.reference_data is not getattr(self, '_last_reference_data', None): + if self.reference_data is not getattr(self, '_last_reference_data', None) or force: self._last_reference_data = self.reference_data # Note that we deliberately use nested delay_callback here, because # we want to make sure that x_att_world and y_att_world both get diff --git a/glue/viewers/image/viewer.py b/glue/viewers/image/viewer.py index c4ffb3b0f..142cd09ef 100644 --- a/glue/viewers/image/viewer.py +++ b/glue/viewers/image/viewer.py @@ -86,6 +86,10 @@ def add_data(self, data): self._set_wcs() return result + def _update_data(self, *args, **kwargs): + super()._update_data(*args, **kwargs) + self.state._reference_data_changed(force=True) + def _on_slice_change(self, event=None): if self._changing_slice_requires_wcs_update: self._set_wcs(relim=False)