77} from "netpyne/components" ;
88
99import { withStyles } from '@material-ui/core/styles'
10-
10+ import Utils from '../Utils' ;
1111const styles = ( { zIndex, palette, spacing } ) => ( {
1212 root : { height : '100%' , overflow : 'hidden' } ,
1313 container : {
@@ -18,7 +18,12 @@ const styles = ({ zIndex, palette, spacing }) => ({
1818 } ,
1919 topbar : { position : "relative" , zIndex : zIndex . drawer + 1 } ,
2020 content : { flexGrow :1 , display : 'flex' , flexDirection : 'row' , position : 'relative' }
21- } )
21+ } ) ;
22+
23+ import {
24+ DEFAULT_HLS_WIDGETS , getPythonDefaultConsoleWidget ,
25+ DEFAULT_MORPHOLOGY_WIDGET , DEFAULT_PLOTS_WIDGETS
26+ } from '../constants'
2227
2328
2429class NetPyNE extends React . Component {
@@ -28,8 +33,32 @@ class NetPyNE extends React.Component {
2833 this . props . pythonCallErrorDialogBox ( payload )
2934 }
3035
36+ addMetadataToWindow ( data ) {
37+ console . log ( "Initialising NetPyNE Tabs" ) ;
38+ window . metadata = data . metadata ;
39+ window . currentFolder = data . currentFolder ;
40+ window . isDocker = data . isDocker ;
41+ window . pythonConsoleLoaded = true
42+ }
43+
3144 componentDidMount ( ) {
32- GEPPETTO . on ( GEPPETTO . Events . Error_while_exec_python_command , this . openPythonCallDialog , this )
45+ GEPPETTO . on ( GEPPETTO . Events . Error_while_exec_python_command , this . openPythonCallDialog , this ) ;
46+ this . props . addWidgets ( [ getPythonDefaultConsoleWidget ( true ) ] ) ;
47+ GEPPETTO . on ( 'jupyter_geppetto_extension_ready' , data => {
48+ let project = { id : 1 , name : 'Project' , experiments : [ { "id" : 1 , "name" : 'Experiment' , "status" : 'DESIGN' } ] }
49+ GEPPETTO . Manager . loadProject ( project , false ) ;
50+ GEPPETTO . Manager . loadExperiment ( 1 , [ ] , [ ] ) ;
51+ Utils . execPythonMessage ( 'from netpyne_ui.netpyne_geppetto import netpyne_geppetto' ) ;
52+ Utils . evalPythonMessage ( 'netpyne_geppetto.getData' , [ ] ) . then ( response => {
53+ const data = Utils . convertToJSON ( response ) ;
54+ this . addMetadataToWindow ( data ) ;
55+ this . props . modelLoaded ( ) ;
56+ this . props . addWidgets ( Object . values ( DEFAULT_HLS_WIDGETS ) ) ;
57+ GEPPETTO . trigger ( "spinner:hide" ) ;
58+ } )
59+
60+ } ) ;
61+
3362 }
3463
3564 componentWillUnmount ( ) {
@@ -38,6 +67,7 @@ class NetPyNE extends React.Component {
3867
3968 render ( ) {
4069 const { classes } = this . props
70+ const Layout = LayoutManager ( ) ;
4171 return (
4272 < div className = { classes . root } >
4373 < div className = { classes . container } >
@@ -46,7 +76,7 @@ class NetPyNE extends React.Component {
4676 </ div >
4777 < div className = { classes . content } >
4878 < Drawer />
49- < LayoutManager />
79+ < Layout />
5080 </ div >
5181 </ div >
5282 </ div >
0 commit comments