From fa97c66776448ed9dc40a9e2c1f9829404984ade Mon Sep 17 00:00:00 2001 From: enicolasgomez Date: Fri, 24 Nov 2023 17:39:45 -0300 Subject: [PATCH] Completed Coords Range missing functionality --- .../components/general/NetPyNECoordsRange.js | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/webapp/components/general/NetPyNECoordsRange.js b/webapp/components/general/NetPyNECoordsRange.js index 51ba51e3..bd0bad21 100644 --- a/webapp/components/general/NetPyNECoordsRange.js +++ b/webapp/components/general/NetPyNECoordsRange.js @@ -96,11 +96,32 @@ export default class NetPyNECoordsRange extends Component { handleCoordParamChange(index, newValue) { const { model, + conds, name, } = this.props; + + function getOppositeObject(list, givenValue) { + const index = list.findIndex(obj => obj.value === givenValue); + + if (index === -1 || list.length !== 2) { + return null; + } + return list[1 - index]; + } + + const opossiteRangeType = getOppositeObject(this.props.items, this.state.rangeType) ; + + if (opossiteRangeType) + { + const pythonMessageDelOpposite = `netpyne_geppetto.${model}['${name}']['${conds}'].pop('${opossiteRangeType.value}', None)`; + Utils.execPythonMessage( + pythonMessageDelOpposite + ); + } + const rangeValue = this.state.rangeValue ; rangeValue[index] = newValue ; - const pythonMessage = `netpyne_geppetto.${model}['${name}']['${this.state.rangeType}'] = [${rangeValue}]` ; + const pythonMessage = `netpyne_geppetto.${model}['${name}']['${conds}']['${this.state.rangeType}'] = [${rangeValue}]` ; Utils.execPythonMessage( pythonMessage );