Skip to content

Commit

Permalink
Fix subset mixed color bug (#2579)
Browse files Browse the repository at this point in the history
* Fix subset mixed color bug
* Move logic to _get_glue_value, which determines mixed state
  • Loading branch information
javerbukh authored Nov 29, 2023
1 parent 2746b72 commit f2647bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ def test_apply_presets(imviz_helper):
arr = np.arange(36).reshape(6, 6)
po = imviz_helper.plugins['Plot Options']

preset_colors_4 = ["#0000FF", "#00FF00", po._obj.swatches_palette[1][0],
po._obj.swatches_palette[0][0]]
preset_colors_4 = ["#0000ff", "#00ff00", po._obj.swatches_palette[1][0].lower(),
po._obj.swatches_palette[0][0].lower()]

# Test applying presets with < 6 layers

Expand Down
4 changes: 4 additions & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,10 @@ def _get_glue_value(self, state):
return getattr(state, glue_name).name
if glue_name in GLUE_STATES_WITH_HELPERS:
return str(getattr(state, glue_name))
if glue_name == 'color':
# Set to lower() so that all linked states of a subset
# (data in viewer with this subset applied) have matching color values
return str(getattr(state, glue_name)).lower()
if glue_name in ('contour_visible', 'bitmap_visible'):
# return False if the layer itself is not visible. Setting this object
# to True will then set both glue_name and visible to True.
Expand Down

0 comments on commit f2647bb

Please sign in to comment.