Skip to content

Commit 7bf1d7e

Browse files
committed
netpyne-106 Add update of settings if coord changes
1 parent a3d51bd commit 7bf1d7e

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

webapp/components/definition/subcellConnectivity/NetPyNESubcellsConnectivityRule.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
3333
errorMessage: undefined,
3434
errorDetails: undefined,
3535
type: 'uniform',
36+
coord: '',
3637
};
3738
}
3839

@@ -120,6 +121,21 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
120121
}
121122
}
122123

124+
handleCoord(value) {
125+
this.setState({ coord: value })
126+
if (value === 'cartesian') {
127+
Utils.execPythonMessage(
128+
`netpyne_geppetto.netParams.subConnParams['${this.props.name}']['density']['coord'] = '${value}'`,
129+
)
130+
Utils.execPythonMessage(`netpyne_geppetto.netParams.defineCellShapes = True`)
131+
} else {
132+
Utils.execPythonMessage(`netpyne_geppetto.netParams.defineCellShapes = False`)
133+
Utils.execPythonMessage(
134+
`del netpyne_geppetto.netParams.subConnParams['${this.props.name}']['density']['coord']`,
135+
)
136+
}
137+
}
138+
123139
densityExtraFun () {
124140
switch (this.state.type) {
125141
case '2DMap':
@@ -175,15 +191,16 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
175191
/>
176192
</NetPyNEField>
177193
<NetPyNEField id="netParams.subConnParams.density.coord">
178-
<NetPyNESelectField
179-
model={`netParams.subConnParams['${this.props.name}']['density']['coord']`}
180-
fullWidth
181-
postProcessItems={() => ["", "cartesian"].map((name, idx) => (
194+
<Select
195+
onChange={(event) => this.handleCoord(event.target.value)}
196+
value={this.state.coord}
197+
fullWidth >
198+
{["", "cartesian"].map((name, idx) => (
182199
<MenuItem id={`${name}MenuItem`} key={`_${name}`} value={name}>
183200
{name}
184201
</MenuItem>
185202
))}
186-
/>
203+
</Select>
187204
</NetPyNEField>
188205
</>
189206
)

0 commit comments

Comments
 (0)