Skip to content

Commit 0b0c153

Browse files
authored
Merge pull request #26 from kdunn926/fix_jupyterlab_1x_support
JupyterLab 1.x support
2 parents b8e816b + f363918 commit 0b0c153

File tree

8 files changed

+794
-1263
lines changed

8 files changed

+794
-1263
lines changed

CONTRIBUTORS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
The people below have contributed to the project by identifying and opening
1616
issues, offering improvements to the documentation or contributing code.
1717

18-
We are certain the list is incomplete; please let one of us know by opening an [issue on GitHub](https://github.com/BruceSherwood/vpython-jupyter/issues) and we will be happy to add your name!
18+
We are certain the list is incomplete; please let one of us know by opening an [issue on GitHub](https://github.com/vpython/vpython-jupyter/issues) and we will be happy to add your name!
1919

2020
+ Wayne Decatur (@fomightez)
2121
+ Tomokazu Higuchi (@higucheese)
@@ -27,6 +27,7 @@ We are certain the list is incomplete; please let one of us know by opening an [
2727
+ @KHALAK
2828
+ @qazwsxedcrfvtg14
2929
+ @russkel
30+
+ Kyle Dunn (@kdunn926)
3031

3132
## Full timeline of vpython development
3233

labextension/vpython/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ For a development install (requires npm version 4 or later), do the following in
2020

2121
```bash
2222
npm install
23-
npm install --save @jupyterlab/notebook @jupyterlab/application @jupyterlab/apputils @jupyterlab/docregistry @phosphor/disposable script-loader
24-
npm run build
23+
cp -r ../../vpython/vpython_{libraries,data} lib/
2524
jupyter labextension install .
2625
```
2726

labextension/vpython/package-lock.json

Lines changed: 761 additions & 523 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

labextension/vpython/package.json

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vpython",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "VPython extension for Jupyterlab",
55
"keywords": [
66
"jupyter",
@@ -14,33 +14,32 @@
1414
"license": "BSD-3-Clause",
1515
"author": "John Coady",
1616
"files": [
17-
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
17+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf,otf}",
1818
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
1919
],
2020
"main": "lib/index.js",
21-
"types": "lib/index.d.ts",
22-
"repository": {
23-
"type": "",
24-
"url": ""
25-
},
21+
"typings": "lib/index.d.ts",
2622
"scripts": {
27-
"build": "tsc",
28-
"clean": "rimraf lib",
29-
"watch": "tsc -w",
30-
"prepare": "npm run build"
23+
"build": "npm run build:src",
24+
"build:src": "tsc",
25+
"clean": "rimraf tsconfig.tsbuildinfo",
26+
"prepublish": "npm run clean && npm run build",
27+
"jpinstall": "jupyter labextension install ."
3128
},
3229
"dependencies": {
33-
"@jupyterlab/application": "^0.19.1",
34-
"@jupyterlab/apputils": "^0.19.1",
35-
"@jupyterlab/docregistry": "^0.19.1",
36-
"@jupyterlab/notebook": "^0.19.1",
37-
"@phosphor/disposable": "^1.1.2",
30+
"@jupyterlab/application": "^1.1.2",
31+
"@jupyterlab/apputils": "^1.1.2",
32+
"@jupyterlab/docregistry": "^1.1.2",
33+
"@jupyterlab/notebook": "^1.1.2",
34+
"@phosphor/disposable": "^1.3.0",
3835
"script-loader": "^0.7.2"
3936
},
4037
"devDependencies": {
38+
"file-loader": "^4.2.0",
39+
"webpack": "^4.0.0",
40+
"@babel/types": "^7.6.1",
4141
"rimraf": "^2.6.1",
42-
"script-loader": "^0.7.2",
43-
"typescript": "~2.9.2"
42+
"typescript": "^3.6.3"
4443
},
4544
"jupyterlab": {
4645
"extension": true

labextension/vpython/src/glowcommlab.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//define(["nbextensions/vpython_libraries/plotly.min",
2-
// "nbextensions/vpython_libraries/glow.min",
3-
// "nbextensions/vpython_libraries/jquery-ui.custom.min"], function(Plotly) {
4-
51
import 'script-loader!./vpython_libraries/jquery.min.js';
62
import 'script-loader!./vpython_libraries/jquery-ui.custom.min.js';
73
import 'script-loader!./vpython_libraries/glow.min.js';
84
import 'script-loader!./vpython_libraries/plotly.min.js';
95
import '../style/jquery-ui.custom.css'
106
import '../style/ide.css'
117

8+
// Ensure downstream JupyterLab webpack places the fonts in predictable locations
9+
import '!!file-loader?name=/vpython_data/[name].[ext]!./vpython_data/Roboto-Medium.ttf'
10+
import '!!file-loader?name=/vpython_data/[name].[ext]!./vpython_data/NimbusRomNo9L-Med.otf'
11+
1212
export var comm
1313
var ws = null
1414
var isopen = false
@@ -60,8 +60,8 @@ export function setupWebsocket(msg) {
6060
wscheckfontsloaded()
6161
}
6262

63-
var datadir = window.location.href + '/static/vpython_data/'
64-
window.Jupyter_VPython = "/lab/static/vpython_data/" // prefix used by glow.min.js for textures
63+
var datadir = '/static/lab/vpython_data/'
64+
window.Jupyter_VPython = "/static/lab/vpython_data/" // prefix used by glow.min.js for textures
6565

6666
function fontloading() {
6767
"use strict";
@@ -1016,4 +1016,4 @@ function handle_attrs(dattrs) {
10161016
}
10171017
console.log("END OF GLOWCOMM")
10181018

1019-
//});
1019+
//});

labextension/vpython/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
} from '@phosphor/disposable';
44

55
import {
6-
JupyterLab, JupyterLabPlugin
6+
JupyterFrontEnd, JupyterFrontEndPlugin
77
} from '@jupyterlab/application';
88

99
import {
@@ -19,7 +19,7 @@ import {
1919
/**
2020
* The plugin registration information.
2121
*/
22-
const plugin: JupyterLabPlugin<void> = {
22+
const plugin: JupyterFrontEndPlugin<void> = {
2323
activate,
2424
id: 'vpython',
2525
autoStart: true
@@ -69,7 +69,7 @@ class VPythonExtension implements DocumentRegistry.IWidgetExtension<NotebookPane
6969
/**
7070
* Activate the extension.
7171
*/
72-
function activate(app: JupyterLab) {
72+
function activate(app: JupyterFrontEnd) {
7373
app.docRegistry.addWidgetExtension('Notebook', new VPythonExtension());
7474
};
7575

@@ -78,4 +78,4 @@ function activate(app: JupyterLab) {
7878
/**
7979
* Export the plugin as default.
8080
*/
81-
export default plugin;
81+
export default plugin;

labextension/vpython/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"compilerOptions": {
33
"allowJs": true,
4-
"lib": ["ES5", "ES2015.Promise", "DOM"],
4+
"lib": ["es6", "ES5", "ES2015.Promise", "DOM"],
55
"module": "commonjs",
66
"moduleResolution": "node",
77
"noImplicitAny": true,
88
"noEmitOnError": true,
99
"noUnusedLocals": true,
1010
"outDir": "./lib",
11-
"target": "ES5",
11+
"target": "es6",
1212
"strict": true,
1313
"strictNullChecks": false,
1414
"types": []

0 commit comments

Comments
 (0)