Skip to content

Commit

Permalink
Completed Coords Range missing functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
enicolasgomez committed Nov 24, 2023
1 parent a45fba1 commit fa97c66
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion webapp/components/general/NetPyNECoordsRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit fa97c66

Please sign in to comment.