From 7ab4f50b04bdb2a3315a7f5895783f5a30512c79 Mon Sep 17 00:00:00 2001 From: Bryan Hilbert Date: Fri, 15 Mar 2024 15:47:09 -0400 Subject: [PATCH 1/2] interactive preview fix --- jwql/utils/interactive_preview_image.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jwql/utils/interactive_preview_image.py b/jwql/utils/interactive_preview_image.py index 1ffd2ab7b..c8a090a28 100644 --- a/jwql/utils/interactive_preview_image.py +++ b/jwql/utils/interactive_preview_image.py @@ -23,6 +23,7 @@ from astropy.io import fits from astropy.visualization import ZScaleInterval, MinMaxInterval, PercentileInterval from astropy.wcs import WCS +from bokeh import events from bokeh.embed import components from bokeh.layouts import gridplot, layout from bokeh.models import ( @@ -554,7 +555,7 @@ def add_interactive_controls(self, images, color_bars): # JS callbacks for client side controls # set alternate image visibility when scale selection changes - scale_group.js_on_click(CustomJS(args={'i1': images[0], 'c1': color_bars[0], + scale_group.js_on_change('labels', CustomJS(args={'i1': images[0], 'c1': color_bars[0], 'i2': images[1], 'c2': color_bars[1]}, code=""" if (i1.visible == true) { @@ -594,10 +595,10 @@ def add_interactive_controls(self, images, color_bars): limit_high.js_link('value', color_bars[i].color_mapper, 'high') # reset boxes to preset range on button click - reset.js_on_click(limit_reset) + reset.js_on_event(events.ButtonClick, limit_reset) # also reset when swapping limit style - scale_group.js_on_click(limit_reset) + scale_group.js_on_change('labels', limit_reset) # return widgets spacer = Spacer(height=20) From 2e32ea9f1d01ce0cd13d096e0a41658a0c37e24d Mon Sep 17 00:00:00 2001 From: Bryan Hilbert Date: Sat, 16 Mar 2024 21:39:28 -0400 Subject: [PATCH 2/2] All buttons are now working --- jwql/utils/interactive_preview_image.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jwql/utils/interactive_preview_image.py b/jwql/utils/interactive_preview_image.py index c8a090a28..1845e0d91 100644 --- a/jwql/utils/interactive_preview_image.py +++ b/jwql/utils/interactive_preview_image.py @@ -23,7 +23,6 @@ from astropy.io import fits from astropy.visualization import ZScaleInterval, MinMaxInterval, PercentileInterval from astropy.wcs import WCS -from bokeh import events from bokeh.embed import components from bokeh.layouts import gridplot, layout from bokeh.models import ( @@ -555,7 +554,7 @@ def add_interactive_controls(self, images, color_bars): # JS callbacks for client side controls # set alternate image visibility when scale selection changes - scale_group.js_on_change('labels', CustomJS(args={'i1': images[0], 'c1': color_bars[0], + scale_group.js_on_change('active', CustomJS(args={'i1': images[0], 'c1': color_bars[0], 'i2': images[1], 'c2': color_bars[1]}, code=""" if (i1.visible == true) { @@ -595,10 +594,10 @@ def add_interactive_controls(self, images, color_bars): limit_high.js_link('value', color_bars[i].color_mapper, 'high') # reset boxes to preset range on button click - reset.js_on_event(events.ButtonClick, limit_reset) + reset.js_on_event('button_click', limit_reset) # also reset when swapping limit style - scale_group.js_on_change('labels', limit_reset) + scale_group.js_on_change('active', limit_reset) # return widgets spacer = Spacer(height=20)