Skip to content

Commit

Permalink
feat(gui): Link day selector to plots
Browse files Browse the repository at this point in the history
  • Loading branch information
nritsche committed Jun 13, 2020
1 parent e1cfa3f commit 9ccb20f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 11 additions & 3 deletions bondia/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,24 @@ def __init__(self):
self.toggle_plot = {}

def populate_template(self):
print(self.config_delayspectrum)
if self.config_delayspectrum:
delay = DelaySpectrumPlot.from_config(self.config_delayspectrum)
self.plot[delay.id] = delay

# TODO: keep available days outside plot
day_selector = pn.widgets.Select(
name="Select LSD", options=delay.index, width=self.width_drawer_widgets
name="Select LSD",
options=list(delay.index.keys()),
width=self.width_drawer_widgets,
)

# Fille the template with components
# Set initial value
delay.lsd = day_selector.value

# Link selected day to plots
day_selector.link(delay, value="lsd")

# Fill the template with components
components = [("day_selector", day_selector)]

# Fill in the plot selection toggle buttons
Expand Down
4 changes: 3 additions & 1 deletion bondia/plots/delayspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def index_files(self, dirs):
log = param.Boolean(default=True)
use_datashader = param.Boolean(default=False)
clim = param.Range(default=(0.1, 10000))
lsd = param.Selector()

# Hide lsd selector by setting precedence<0
lsd = param.Selector(precedence=-1)

@param.depends("lsd", "transpose", "log", "use_datashader", "clim")
def view(self):
Expand Down

0 comments on commit 9ccb20f

Please sign in to comment.