Skip to content

Commit dbfca3b

Browse files
author
rodriguez-facundo
committed
#139 Focus tabs by clicking the docker and create tabsets if they don't exist
1 parent 8403f59 commit dbfca3b

5 files changed

Lines changed: 30 additions & 23 deletions

File tree

webapp/components/NetPyNE.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ class NetPyNE extends React.Component {
6161
</div>
6262

6363

64-
<div className={classes.console}>
65-
{/* Flexlayout bottom panel gives weird layout so can't send the console there
66-
when the widget is closed and the python console must remain open somewhere for the app to sync
67-
*/}
68-
{!this.props.pythonConsoleWidget ? <NetPyNEPythonConsole /> : null}
69-
</div>
64+
{/* <div className={classes.console}>
65+
// Flexlayout bottom panel gives weird layout so can't send the console there
66+
// when the widget is closed and the python console must remain open somewhere for the app to sync
67+
68+
{!this.props.pythonConsoleWidget ? <NetPyNEPythonConsole /> : null}
69+
</div> */}
7070

7171

7272
</div>

webapp/components/layout/LayoutManager.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,34 +136,38 @@ class LayoutManager extends Component {
136136
if (tabset === undefined) {
137137
this.createTabSet(widgetConfiguration.panelName)
138138
}
139-
this.refs.layout.addTabToTabSet(widgetConfiguration.panelName, widget2Node(widgetConfiguration))
139+
if (widgetConfiguration.status === WidgetStatus.BORDER){
140+
this.refs.layout.addTabToTabSet('border_bottom', widget2Node(widgetConfiguration))
141+
} else {
142+
this.refs.layout.addTabToTabSet(widgetConfiguration.panelName, widget2Node(widgetConfiguration))
143+
}
144+
140145
}
141146

142147
createTabSet (tabsetID) {
143148
// In case the tabset doesn't exist
144149
const model = this.getModel()
145150
const rootNode = model.getNodeById("root")
146151

147-
const pyPanel = model.getNodeById('consolePanel')
148-
if (pyPanel) {
149-
pyPanel._setWeight(20)
150-
}
151-
152152
let hrow = new FlexLayout.RowNode(model, {});
153153
hrow._setWeight(100)
154154

155155
const tabset = new FlexLayout.TabSetNode(model, { id: tabsetID });
156156
tabset._setWeight(80)
157-
157+
158158
hrow._addChild(tabset)
159-
160-
rootNode.getChildren().forEach(child => hrow._addChild(child))
159+
160+
rootNode.getChildren().forEach(child => {
161+
const newWeight = child.getWeight() / 2
162+
child._setWeight(newWeight)
163+
hrow._addChild(child)
164+
})
165+
161166
rootNode._removeAll()
162167
rootNode._addChild(hrow, 0);
163168
if (!this.props.editMode && tabsetID === 'plotPanel') {
164169
// We need to resize Geppetto 3D canvas to new panel sizes
165170
setTimeout(() => window.dispatchEvent(new Event('resize')), 1000)
166-
167171
}
168172
}
169173

webapp/components/layout/layoutConf.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
"sideBorders": 8,
44
"tabSetHeaderHeight": 26,
55
"tabSetTabStripHeight": 26,
6-
"enableEdgeDock": false
6+
"enableEdgeDock": false,
7+
"borderBarSize": "0px"
78
},
89
"layout": {
910
"type": "tabset",
1011
"weight": 100,
1112
"id": "root",
12-
"children": []
13+
"children": [
14+
15+
]
1316
}
1417
}
1518

webapp/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const WidgetStatus = {
1212
HIDDEN: 'HIDDEN',
1313
ACTIVE: 'ACTIVE',
1414
MAXIMIZED: 'MAXIMIZED',
15-
MINIMIZED: 'MINIMIZED'
15+
MINIMIZED: 'MINIMIZED',
16+
BORDER: 'BORDER'
1617
};
1718

1819
export const MODEL_STATE = {

webapp/redux/reducers/flexlayout.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,10 @@ export const HLS_WIDGETS = {
310310
}
311311

312312
export const FLEXLAYOUT_DEFAULT_STATE = {
313-
// 'python': PYTHON_CONSOLE_WIDGET
314-
widgets: {},
313+
widgets: { python: PYTHON_CONSOLE_WIDGET },
315314
widgetsBackground: {
316-
'D3Canvas': MORPHOLOGY_WIDGET,
317-
// 'python': PYTHON_CONSOLE_WIDGET,
315+
D3Canvas: MORPHOLOGY_WIDGET,
316+
python: PYTHON_CONSOLE_WIDGET,
318317
}
319318
};
320319

0 commit comments

Comments
 (0)