Skip to content

Commit

Permalink
allow change in cmap_att on change in data components
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Nov 13, 2023
1 parent 6acb64a commit 1dc9c1e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,16 +2899,19 @@ def _on_viewer_layer_changed(self, msg=None):
if glue_name in ['contour_visible', 'bitmap_visible']:
state.add_callback('visible', self._on_glue_layer_visible_changed)

if self.sync.get('choices') is None and \
(hasattr(getattr(type(state), glue_name), 'get_display_func')
or glue_name == 'cmap'):
if (
self.sync.get('choices') is None and
(
hasattr(getattr(type(state), glue_name), 'get_display_func') or
glue_name == 'cmap'
)
) or glue_name == 'cmap_att':
# then we can access and populate the choices. We are assuming here
# that each state-instance with this same name will have the same
# choices and that those will not change. If we ever hookup options
# with changing choices, we'll need additional logic to sync to those
# and handle mixed state in the choices...
self.sync = {**self.sync, 'choices': self._get_glue_choices(state)}

self.sync = {**self.sync,
'in_subscribed_states': in_subscribed_states,
'icons': icons,
Expand Down

0 comments on commit 1dc9c1e

Please sign in to comment.