Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions glue/viewers/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,25 +207,27 @@ def add_data(self, data):
if data not in self.session.data_collection:
raise IncompatibleDataException("Data not in DataCollection")

# Create layer artist and add to container. First check whether any
# plugins want to make a custom layer artist.
layer = get_layer_artist_from_registry(data, self) or self.get_data_layer_artist(data)
with delay_callback(self.state, 'layers'):

if layer is None:
return False
# Create layer artist and add to container. First check whether any
# plugins want to make a custom layer artist.
layer = get_layer_artist_from_registry(data, self) or self.get_data_layer_artist(data)

# When adding a layer artist to the layer artist container, zorder
# gets set automatically - however since we call a forced update of the
# layer after adding it to the container we can ignore any callbacks
# related to zorder. We also then need to set layer.state.zorder manually.
with ignore_callback(layer.state, 'zorder'):
self._layer_artist_container.append(layer)
layer.update()
self.draw_legend() # need to be called here because callbacks are ignored in previous step
if layer is None:
return False

# Add existing subsets to viewer
for subset in data.subsets:
self.add_subset(subset)
# When adding a layer artist to the layer artist container, zorder
# gets set automatically - however since we call a forced update of the
# layer after adding it to the container we can ignore any callbacks
# related to zorder. We also then need to set layer.state.zorder manually.
with ignore_callback(layer.state, 'zorder'):
self._layer_artist_container.append(layer)
layer.update()
self.draw_legend() # need to be called here because callbacks are ignored in previous step

# Add existing subsets to viewer
for subset in data.subsets:
self.add_subset(subset)

return True

Expand Down
Loading