Skip to content
Snippets Groups Projects
Commit f6beb5db authored by Hammouda Elbez's avatar Hammouda Elbez :computer:
Browse files

Synapse Module: Added Heatmap Editor

parent 2358ebbf
Branches
No related tags found
1 merge request!26Custom 2d view
......@@ -58,8 +58,10 @@ class callbacks(callbacksOp):
the updated content of 'GraphsAreaSynapse' and 'GlobalHeatMapAreaSynapse'
"""
context = dash.callback_context.triggered
print(context,selectedNeuron)
if "AddComponentSynapse" in context[0]['prop_id']:
if context[0]['value'] == 0:
selectedNeuron = None
# Add item
if(selectedLayer != None and (selectedNeuron != None and len(selectedNeuron) != 0)):
if len(selectedNeuron) > 0:
......@@ -72,7 +74,7 @@ class callbacks(callbacksOp):
else:
return [graphsArea, GlobalHeatmap]
else:
data = None
data = pd.DataFrame({})
if selectedLayer != None:
if(selectedLayer in super.globalHeatMap):
data = super.globalHeatMap[selectedLayer]
......@@ -270,7 +272,7 @@ class callbacks(callbacksOp):
try:
# Callback to handle heatmap flipping if needed
@app.callback([Output("heatmapEditInfo", "data")],[Input('FlipHeatmapH', 'n_clicks'),Input('FlipHeatmapV', 'n_clicks'),Input('RotateHeatmap', 'n_clicks'),State("heatmapEditInfo", "data")])
@app.callback([Output("heatmapEditInfo", "data"),Output("AddComponentSynapse", "n_clicks")],[Input('FlipHeatmapH', 'n_clicks'),Input('FlipHeatmapV', 'n_clicks'),Input('RotateHeatmap', 'n_clicks'),State("heatmapEditInfo", "data")])
def HeatmapFlip(FlipHeatmapH, FlipHeatmapV, RotateHeatmap, heatmapEditInfo):
""" Function called when flip button clicked
......@@ -284,6 +286,7 @@ class callbacks(callbacksOp):
if global heatmaps tab should be opened or closed
"""
context = dash.callback_context.triggered
if "FlipHeatmapH" in context[0]['prop_id']:
heatmapEditInfo[0] = not heatmapEditInfo[0]
elif "FlipHeatmapV" in context[0]['prop_id']:
......@@ -291,7 +294,7 @@ class callbacks(callbacksOp):
else:
heatmapEditInfo[2] = not heatmapEditInfo[2]
return [heatmapEditInfo]
return [heatmapEditInfo,0]
except Exception:
print("HeatmapFlip: "+ traceback.format_exc())
......
......@@ -68,6 +68,7 @@ class layout(layoutOp):
dbc.Button(html.I(className="fa-solid fa-plus"), id="AddComponentSynapse", n_clicks=0, style={
"fontWeight": "500", "marginLeft": "20px", "height": "36px",
"backgroundColor":"rgb(68, 71, 99)","borderColor":"rgb(68, 71, 99)"}),
html.P("Heatmap Editor:", style={"textAlign": "start", "marginLeft": "20px", "marginTop": "4px"}),
dbc.Button(html.I(className="fa-solid fa-left-right"), id="FlipHeatmapH", n_clicks=0, style={"fontWeight": "500", "marginLeft": "20px", "height": "36px","backgroundColor":"rgb(68, 71, 99)","borderColor":"rgb(68, 71, 99)", "color":"white"}),
dbc.Button(html.I(className="fa-solid fa-up-down"), id="FlipHeatmapV", n_clicks=0, style={"fontWeight": "500", "marginLeft": "20px", "height": "36px","backgroundColor":"rgb(68, 71, 99)","borderColor":"rgb(68, 71, 99)", "color":"white"}),
dbc.Button(html.I(className="fa-solid fa-rotate"), id="RotateHeatmap", n_clicks=0, style={"fontWeight": "500", "marginLeft": "20px", "height": "36px","backgroundColor":"rgb(68, 71, 99)","borderColor":"rgb(68, 71, 99)", "color":"white"}),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment