Skip to content

Commit

Permalink
some hot bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaryss committed Apr 20, 2023
1 parent 37fad1b commit f82de4e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
9 changes: 8 additions & 1 deletion pyquac/assets/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
x_fit,
y_fit,
fit_curve_show,
line_switch,
x,
y,
z,
Expand All @@ -19,7 +20,6 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
yz_scatter,
x_scatter,
xz_scatter,
line_switch,
x_title,
y_title,

Expand Down Expand Up @@ -92,6 +92,8 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
figure["data"][0]["y"] = y;
figure["data"][0]["z"] = z;

figure["data"][3]["visible"] = false;

// figure["layout"]["yaxis"]["range"][0] = Math.min(y);
// figure["layout"]["yaxis"]["range"][1] = Math.max(y);
// figure["layout"]["xaxis"]["range"][0] = Math.min(x);
Expand All @@ -104,6 +106,11 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
if (triggered_id === "fit_curve_show.on") {
figure["data"][3]["visible"] = fit_curve_show;
}

if (triggered_id === "line-switches.on") {
figure["layout"]["shapes"][0]["visible"] = line_switch;
figure["layout"]["shapes"][1]["visible"] = line_switch;
}
return figure;
},
},
Expand Down
2 changes: 1 addition & 1 deletion pyquac/components/fit_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def input_settings(
dbc.Col(
daq.BooleanSwitch(
id="fit_curve_show",
on=True,
on=False,
color="#3459e6",
),
width=4,
Expand Down
2 changes: 1 addition & 1 deletion pyquac/components/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def define_figure(
name="fit",
line_color="#000000",
line_width=3,
visible=True,
visible=False,
)
)

Expand Down
2 changes: 1 addition & 1 deletion pyquac/components/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
dbc.Col(
daq.BooleanSwitch(
id="interval-switches",
on=True,
on=False,
color="#3459e6",
),
width=4,
Expand Down
16 changes: 10 additions & 6 deletions pyquac/fmn_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"x_label": settings.init_x_label,
"y_label": settings.init_y_label,
}

########################## App Layout ##########################


Expand Down Expand Up @@ -291,6 +292,7 @@ def toggle_graph(n, nclick):
Input("x_fit", "data"),
Input("y_fit", "data"),
Input("fit_curve_show", "on"),
Input("line-switches", "on"),
State("x_store", "data"),
State("y_store", "data"),
State("z_store", "data"),
Expand All @@ -299,7 +301,6 @@ def toggle_graph(n, nclick):
State("yz_scatter", "data"),
State("x_scatter", "data"),
State("xz_scatter", "data"),
State("line-switches", "on"),
State("x-title", "value"),
State("y-title", "value"),
prevent_initial_call=True,
Expand Down Expand Up @@ -595,10 +596,12 @@ def toggle_nav(n, nclick):
Output("sidebar", "style"),
Output("page-content", "style"),
Output("side_click", "data"),
Output("x_selection", "on"),
Input("btn_sidebar", "n_clicks"),
State("x_selection", "on"),
State("side_click", "data"),
)
def toggle_sidebar(n, nclick):
def toggle_sidebar(n, x_selection, nclick):
"""function to hide and reveal sidebar
Args:
Expand All @@ -613,6 +616,7 @@ def toggle_sidebar(n, nclick):
sidebar_style = SIDEBAR_HIDEN
content_style = CONTENT_STYLE1
cur_nclick = "HIDDEN"
x_selection = False
else:
sidebar_style = SIDEBAR_STYLE
content_style = CONTENT_STYLE
Expand All @@ -622,11 +626,11 @@ def toggle_sidebar(n, nclick):
content_style = CONTENT_STYLE
cur_nclick = "SHOW"

return sidebar_style, content_style, cur_nclick
return sidebar_style, content_style, cur_nclick, x_selection

@app.callback(
Output("interval-graph-update", "max_intervals"),
Output("line-switches", "disabled"),
# Output("line-switches", "disabled"),
Input("interval-switches", "on"),
Input("modal_db", "is_open"),
)
Expand All @@ -647,9 +651,9 @@ def toggle_checklist(switch_state, db_open):
else:
new_max_interval = 0
disabled = True
return new_max_interval, disabled
return new_max_interval
else:
return 0, switch_state
return 0

@app.callback(
Output("interval-graph-update", "interval"),
Expand Down

0 comments on commit f82de4e

Please sign in to comment.