Skip to content

Commit

Permalink
Merge pull request #331 from astrofrog/fix-image-layer-update
Browse files Browse the repository at this point in the history
Fix compatibility of image viewer with recent versions of glue-core
  • Loading branch information
astrofrog committed Oct 31, 2022
2 parents b5191ba + 0b82c45 commit 4852b7f
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions glue_jupyter/bqplot/image/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,16 @@ def get_image_data(self, *args, **kwargs):
return super().get_image_data(*args, **kwargs)

def _update_visual_attributes(self):
# TODO: this is a copy of the super method, adding in the bitmap_visible state

if not self.enabled:
return

if self._viewer_state.color_mode == 'Colormaps':
color = self.state.cmap
else:
color = self.state.color

self.composite.set(self.uuid,
clim=(self.state.v_min, self.state.v_max),
visible=self.state.visible and self.state.bitmap_visible,
zorder=self.state.zorder,
color=color,
contrast=self.state.contrast,
bias=self.state.bias,
alpha=self.state.alpha,
stretch=self.state.stretch)

self.composite_image.invalidate_cache()
super()._update_visual_attributes()

was_visble = self.contour_artist.visible
self.contour_artist.visible = self.state.visible and self.state.contour_visible
if not was_visble and self.contour_artist.visible:
# switching from invisible to visible may leave the contour lines in an inconsistemt
# state, since we don't update them when invisible, so we have to update them
self._update_contour_lines()

self.redraw()

def _update_contour_lines(self):
Expand Down

0 comments on commit 4852b7f

Please sign in to comment.