11import React from "react" ;
22import Toolbar from "@material-ui/core/Toolbar" ;
3- import Transition from "./transition/Transition" ;
3+
44import {
5- NetPyNESynapses ,
6- NetPyNEConnectivityRules ,
7- NetPyNECellRules ,
8- NetPyNEStimulationSources ,
9- NetPyNEStimulationTargets ,
10- NetPyNESimConfig ,
115 NetPyNEToolBar ,
126 NetPyNETabs ,
13- NetPyNEPopulations ,
147 LayoutManager ,
15- NetPyNEPlots
8+ Drawer
169} from "netpyne/components" ;
1710
18- export default class NetPyNE extends React . Component {
19- constructor ( props ) {
20- super ( props ) ;
21- this . widgets = { } ;
22-
23- }
11+ import { withStyles } from '@material-ui/core/styles'
12+
13+ const styles = ( { zIndex, palette, spacing } ) => ( {
14+ container : {
15+ height : "100%" ,
16+ width : "100%" ,
17+ display : "flex" ,
18+ flexDirection : "column"
19+ } ,
20+ toolbar : {
21+ backgroundColor : palette . primary . main ,
22+ width : "100%" ,
23+ boxShadow : "0 0px 4px 0 rgba(0, 0, 0, 0.2), 0 0px 8px 0 rgba(0, 0, 0, 0.19)" ,
24+ position : "relative" ,
25+ top : 0 ,
26+ left : 0 ,
27+ zIndex : zIndex . appBar
28+ } ,
29+ views : {
30+ display : "flex" ,
31+ flexFlow : "rows" ,
32+ width : "100%" ,
33+ marginRight : spacing ( - 1 )
34+ } ,
35+ drawer : { marginLeft : spacing ( - 1 ) } ,
36+ content : { position : "relative" , zIndex : zIndex . drawer + 1 }
37+ } )
2438
39+
40+ class NetPyNE extends React . Component {
41+
2542 openPythonCallDialog ( event ) {
2643 const payload = { errorMessage : event [ 'evalue' ] , errorDetails : event [ 'traceback' ] . join ( '\n' ) }
2744 this . props . pythonCallErrorDialogBox ( payload )
@@ -35,94 +52,27 @@ export default class NetPyNE extends React.Component {
3552 GEPPETTO . off ( GEPPETTO . Events . Error_while_exec_python_command , this . openPythonCallDialog , this )
3653 }
3754
38- UNSAFE_componentWillReceiveProps ( nextProps ) {
39- if ( this . props . data != nextProps . data ) {
40- console . log ( "Initialising NetPyNE Tabs" ) ;
41-
42- window . metadata = nextProps . data . metadata ;
43- window . currentFolder = nextProps . data . currentFolder ;
44- window . isDocker = nextProps . data . isDocker ;
45- }
46- }
47-
48-
4955 render ( ) {
50- if ( ! this . props . data ) {
51- return < div > </ div > ;
52- } else {
53- if ( this . props . editMode ) {
54- var content = (
55- < div style = { { marginBottom : "50px" } } >
56- < NetPyNEPopulations model = { "netParams.popParams" } />
57- < NetPyNECellRules model = { "netParams.cellParams" } />
58- < NetPyNESynapses model = { "netParams.synMechParams" } />
59- < NetPyNEConnectivityRules model = { "netParams.connParams" } />
60- < NetPyNEStimulationSources model = { "netParams.stimSourceParams" } />
61- < NetPyNEStimulationTargets model = { "netParams.stimTargetParams" } />
62- < NetPyNESimConfig model = { this . props . data . simConfig } />
63- < NetPyNEPlots model = { "simConfig.analysis" } />
64- </ div >
65- ) ;
66- } else {
67- var content = < LayoutManager /> ;
68- }
56+ const { classes } = this . props
6957
70- return (
71- < div
72- style = { {
73- height : "100%" ,
74- width : "100%" ,
75- display : "flex" ,
76- flexDirection : "column"
77- } }
78- >
79- < div style = { { position : "relative" , zIndex : "100" } } >
80- < Toolbar
81- id = "appBar"
82- style = { {
83- backgroundColor : "#543a73" ,
84- width : "100%" ,
85- boxShadow :
86- "0 0px 4px 0 rgba(0, 0, 0, 0.2), 0 0px 8px 0 rgba(0, 0, 0, 0.19)" ,
87- position : "relative" ,
88- top : "0px" ,
89- left : "0px" ,
90- zIndex : 100
91- } }
92- >
93- < div style = { { marginLeft : - 12 } } >
94- < NetPyNEToolBar />
95- </ div >
96- < div
97- style = { {
98- display : "flex" ,
99- flexFlow : "rows" ,
100- width : "100%" ,
101- marginRight : - 10
102- } }
103- >
104- < NetPyNETabs />
105- </ div >
106- </ Toolbar >
107- </ div >
108-
109- { /** TODO Reengineer Transition using the middleware to handle simulation and instantiation. The transition should only show content related to what actually we want to do
110- <Transition
111- tab={this.state.value}
112- clickOnTab={this.state.tabClicked}
113- handleDeactivateInstanceUpdate={this.handleDeactivateInstanceUpdate}
114- handleDeactivateSimulationUpdate={
115- this.handleDeactivateSimulationUpdate
116- }
117- freezeInstance={this.state.freezeInstance}
118- freezeSimulation={this.state.freezeSimulation}
119- fastForwardInstantiation={this.state.fastForwardInstantiation}
120- fastForwardSimulation={this.state.fastForwardSimulation}
121- /> */ }
122-
123- { content }
58+ return (
59+ < div className = { classes . container } >
60+ < div className = { classes . content } >
61+ < Toolbar id = "appBar" className = { classes . toolbar } >
62+ < div className = { classes . drawer } >
63+ < NetPyNEToolBar />
64+ </ div >
65+ < div className = { classes . views } >
66+ < NetPyNETabs />
67+ </ div >
68+ </ Toolbar >
69+ </ div >
70+ < div style = { { flexGrow :1 , display : 'flex' , flexDirection : 'row' , position : 'relative' } } >
71+ < Drawer />
72+ < LayoutManager />
12473 </ div >
125- ) ;
126- }
74+ </ div >
75+ ) ;
12776 }
12877}
78+ export default withStyles ( styles ) ( NetPyNE )
0 commit comments