Add translation of wavelengths and xlim updates

This commit is contained in:
rasmusvt 2022-03-18 16:55:43 +01:00
parent a96210cf07
commit 9bb52fe819
3 changed files with 107 additions and 300 deletions

View file

@ -298,6 +298,7 @@ def ipywidgets_update(func, data, options={}, **kwargs):
where key1, key2, key3 etc. are the values in the options-dictionary you want widget control of, and widget1, widget2, widget3 etc. are widgets to control these values, e.g. widgets.IntSlider(value=1, min=0, max=10)
'''
# Update the options-dictionary with the values from the widgets
for key in kwargs:
options[key] = kwargs[key]
@ -306,6 +307,16 @@ def ipywidgets_update(func, data, options={}, **kwargs):
func(data=data, options=options)
def update_widgets(options):
for widget in options['widgets'].values():
if widget['state'] != options['x_vals']:
for arg in widget[f'{options["x_vals"]}_default']:
setattr(widget['w'], arg, widget[f'{options["x_vals"]}_default'][arg])
widget['state'] = options['x_vals']
def determine_width(format_params):