Skip to content

Commit d49461c

Browse files
committed
Jupyterlab extension
1 parent 7878ea6 commit d49461c

File tree

5 files changed

+40
-1
lines changed

5 files changed

+40
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules/
77

88
# Compiled javascript
99
pythreejs/static/
10+
pythreejs/staticlab/
1011

1112
# OS X
1213
.DS_Store

js/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
},
1616
"devDependencies": {
1717
"json-loader": "^0.5.4",
18+
"jupyterlab-extension-builder": "^0.6.2",
1819
"rimraf": "^2.4.1",
1920
"webpack": "^1.12.14"
2021
},
2122
"dependencies": {
2223
"jquery": "^2.1.4",
23-
"jupyter-js-widgets": "^1.0.0",
24+
"jupyter-js-widgets": "^2.0.0-dev.21",
25+
"jupyterlab": "^0.3.0",
26+
"jupyterlab_widgets": "^0.2.2",
2427
"three": "^0.75.0",
2528
"underscore": "^1.8.3"
2629
}

js/src/labplugin.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var jupyter_threejs = require('./index');
2+
3+
var jupyterlab_widgets = require('jupyterlab_widgets/lib/plugin');
4+
5+
module.exports = {
6+
id: 'jupyter.extensions.jupyter-threejs',
7+
requires: [jupyterlab_widgets.IIPyWidgetExtension],
8+
activate: function(app, widgets) {
9+
widgets.registerWidget({
10+
name: 'jupyter-threejs',
11+
version: jupyter_threejs.version,
12+
exports: jupyter_threejs
13+
});
14+
},
15+
autoStart: true
16+
};

js/webpack.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@ var loaders = [
22
{ test: /\.json$/, loader: "json-loader" },
33
];
44

5+
var buildExtension = require('jupyterlab-extension-builder/lib/builder').buildExtension;
6+
7+
buildExtension({
8+
name: 'jupyter-threejs',
9+
entry: './src/labplugin',
10+
outputDir: '../pythreejs/staticlab',
11+
config: {
12+
module: {
13+
loaders: []
14+
}
15+
}
16+
});
17+
518
module.exports = [
619
{// Notebook extension
720
entry: './src/extension.js',

pythreejs/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,9 @@ def _jupyter_nbextension_paths():
143143
'dest': npm_pkg_name,
144144
'require': npm_pkg_name + '/extension'
145145
}]
146+
147+
def _jupyter_labextension_paths():
148+
return [{
149+
'name': npm_pkg_name,
150+
'src': 'staticlab'
151+
}]

0 commit comments

Comments
 (0)