@@ -14,34 +14,24 @@ export default class NetPyNECoordsRange extends Component {
1414 this . _isMounted = false ;
1515 }
1616
17- triggerUpdate ( updateMethod ) {
18- // common strategy when triggering processing of a value change, delay it, every time there is a change we reset
19- if ( this . updateTimer != undefined ) {
20- clearTimeout ( this . updateTimer ) ;
21- }
22- this . updateTimer = setTimeout ( updateMethod , 1000 ) ;
23- }
24-
2517 componentDidMount ( ) {
2618 this . _isMounted = true ;
2719 this . updateLayout ( ) ;
2820 }
2921
3022 componentDidUpdate ( prevProps , prevState ) {
3123 if ( this . props . name != prevProps . name ) {
32- this . triggerUpdate ( ( ) => {
33- const message = `netpyne_geppetto.${ this . props . model } ['${ this . props . name } ']${ ( this . props . conds != undefined ) ? `['${ this . props . conds } ']` : '' } ` ;
34- Utils
35- . evalPythonMessage ( `[key in ${ message } for key in ['${ this . props . items [ 0 ] . value } ', '${ this . props . items [ 1 ] . value } ']]` )
36- . then ( ( response ) => {
37- if ( response [ 0 ] && this . _isMounted === true ) {
38- this . setState ( { rangeType : this . props . items [ 0 ] . value } ) ;
39- } else if ( response [ 1 ] && this . _isMounted === true ) {
40- this . setState ( { rangeType : this . props . items [ 1 ] . value } ) ;
41- } else if ( this . _isMounted === true ) {
42- this . setState ( { rangeType : undefined } ) ;
43- }
44- } ) ;
24+ const message = `netpyne_geppetto.${ this . props . model } ['${ this . props . name } ']${ ( this . props . conds != undefined ) ? `['${ this . props . conds } ']` : '' } ` ;
25+ Utils
26+ . evalPythonMessage ( `[key in ${ message } for key in ['${ this . props . items [ 0 ] . value } ', '${ this . props . items [ 1 ] . value } ']]` )
27+ . then ( ( response ) => {
28+ if ( response [ 0 ] && this . _isMounted === true ) {
29+ this . setState ( { rangeType : this . props . items [ 0 ] . value } ) ;
30+ } else if ( response [ 1 ] && this . _isMounted === true ) {
31+ this . setState ( { rangeType : this . props . items [ 1 ] . value } ) ;
32+ } else if ( this . _isMounted === true ) {
33+ this . setState ( { rangeType : undefined } ) ;
34+ }
4535 } ) ;
4636 } else if ( this . props . conds != prevProps . conds ) {
4737 this . updateLayout ( ) ;
@@ -85,6 +75,14 @@ export default class NetPyNECoordsRange extends Component {
8575 this . _isMounted = false ;
8676 }
8777
78+ //preConds: pop, cellType, cellModel, x, y, z, xnorm, ynorm, znorm
79+ handleCoordParamChange ( a , b , newValue ) {
80+ const pythonMessage = `netpyne_geppetto.${ this . model } = [${ newValue } ]` ;
81+ Utils . execPythonMessage (
82+ pythonMessage
83+ ) ;
84+ }
85+
8886 render ( ) {
8987 if ( this . props . conds != undefined ) {
9088 var meta = `${ this . props . model } .${ this . props . conds } .${ this . props . items [ 0 ] . value } ` ;
@@ -127,6 +125,7 @@ export default class NetPyNECoordsRange extends Component {
127125 return output ;
128126 }
129127 } }
128+ onChange = { this . handleCoordParamChange }
130129 >
131130 < TextField label = "Minimum" id = { min } variant = "filled" fullWidth />
132131 < TextField label = "Maximum" id = { max } variant = "filled" fullWidth />
0 commit comments