From 8b0f7fbebfdd994c4147619606e9dd7e1f72ae4b Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Sat, 29 Feb 2020 15:02:35 +0100 Subject: [PATCH 1/2] Update to JLab 2.0 and latest ipywidgets --- README.md | 2 +- css/widget.css | 2 +- package.json | 20 ++++++++++---------- src/widgets/commands.ts | 6 +++--- src/widgets/split_panel.ts | 18 +++++++++--------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 6901f677..67beb1eb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Control JupyterLab from Python notebooks. The goal is to provide access to most of the JupyterLab environment from Python notebooks. For example: - Adding widgets to the main area `DockPanel`, left, right or top area -- Build more advanced interfaces leveraging `SplitPanel`, `Toolbar` and other Phosphor widgets +- Build more advanced interfaces leveraging `SplitPanel`, `Toolbar` and other Lumino widgets - Launch arbitrary commands (new terminal, change theme, open file and so on) - Open a workspace with a specific layout - Listen to JupyterLab signals (notebook opened, console closed) and trigger Python callbacks diff --git a/css/widget.css b/css/widget.css index 5cb30e2b..fb8f37ac 100644 --- a/css/widget.css +++ b/css/widget.css @@ -1,5 +1,5 @@ /* Default Split Handle Color*/ -.jp-JupyterPhosphorSplitPanelWidget .p-SplitPanel-handle { +.jp-JupyterLuminoSplitPanelWidget .p-SplitPanel-handle { background-color: var(--jp-border-color2); } diff --git a/package.json b/package.json index 31bd7c61..e69eba7b 100644 --- a/package.json +++ b/package.json @@ -59,18 +59,18 @@ ] }, "dependencies": { - "@jupyter-widgets/base": "^1 || ^2", - "@jupyter-widgets/controls": "^1.5.3", - "@jupyter-widgets/jupyterlab-manager": "^1.0.0", - "@jupyterlab/application": "^1.2.0", - "@jupyterlab/apputils": "^1.2.1", - "@jupyterlab/observables": "^2.4.0", - "@phosphor/commands": "^1.7.2", - "@phosphor/disposable": "1.3.1", - "@phosphor/widgets": "^1.9.3" + "@jupyter-widgets/base": "^1 || ^3.0.0-rc.0", + "@jupyter-widgets/controls": "^2.0.0-rc.12", + "@jupyter-widgets/jupyterlab-manager": "^2.0.0-rc.3", + "@jupyterlab/application": "^2.0.0", + "@jupyterlab/apputils": "^2.0.0", + "@jupyterlab/observables": "^3.0.0", + "@lumino/commands": "^1.10.1", + "@lumino/disposable": "^1.3.5", + "@lumino/widgets": "^1.11.1" }, "devDependencies": { - "@phosphor/application": "^1.6.0", + "@lumino/application": "^1.8.4", "@types/expect.js": "^0.3.29", "@types/mocha": "^5.2.5", "@types/node": "^10.11.6", diff --git a/src/widgets/commands.ts b/src/widgets/commands.ts index 6cf1cf82..1acb2d7c 100644 --- a/src/widgets/commands.ts +++ b/src/widgets/commands.ts @@ -3,11 +3,11 @@ import { ObservableMap } from '@jupyterlab/observables'; -import { CommandRegistry } from '@phosphor/commands'; +import { ISerializers, WidgetModel } from '@jupyter-widgets/base'; -import { IDisposable } from '@phosphor/disposable'; +import { CommandRegistry } from '@lumino/commands'; -import { ISerializers, WidgetModel } from '@jupyter-widgets/base'; +import { IDisposable } from '@lumino/disposable'; import { MODULE_NAME, MODULE_VERSION } from '../version'; diff --git a/src/widgets/split_panel.ts b/src/widgets/split_panel.ts index ace62f0d..5cee170f 100644 --- a/src/widgets/split_panel.ts +++ b/src/widgets/split_panel.ts @@ -1,13 +1,13 @@ // Copyright (c) Jeremy Tuloup // Distributed under the terms of the Modified BSD License. -import { JupyterPhosphorWidget, DOMWidgetView } from '@jupyter-widgets/base'; +import { JupyterLuminoWidget, DOMWidgetView } from '@jupyter-widgets/base'; import { VBoxView } from '@jupyter-widgets/controls'; -import { Message } from '@phosphor/messaging'; +import { Message } from '@lumino/messaging'; -import { SplitPanel } from '@phosphor/widgets'; +import { SplitPanel } from '@lumino/widgets'; import $ from 'jquery'; @@ -15,18 +15,18 @@ import { PanelModel } from './panel'; import { MODULE_NAME, MODULE_VERSION } from '../version'; -class JupyterPhosphorSplitPanelWidget extends SplitPanel { - constructor(options: JupyterPhosphorWidget.IOptions & SplitPanel.IOptions) { +class JupyterLuminoSplitPanelWidget extends SplitPanel { + constructor(options: JupyterLuminoWidget.IOptions & SplitPanel.IOptions) { let view = options.view; delete options.view; super(options); - this.addClass('jp-JupyterPhosphorSplitPanelWidget'); + this.addClass('jp-JupyterLuminoSplitPanelWidget'); this._view = view; } processMessage(msg: Message) { super.processMessage(msg); - this._view.processPhosphorMessage(msg); + this._view.processLuminoMessage(msg); } dispose() { @@ -66,7 +66,7 @@ export class SplitPanelModel extends PanelModel { export class SplitPanelView extends VBoxView { _createElement(tagName: string) { - this.pWidget = new JupyterPhosphorSplitPanelWidget({ + this.pWidget = new JupyterLuminoSplitPanelWidget({ view: this, orientation: this.model.get('orientation') }) as any; @@ -84,7 +84,7 @@ export class SplitPanelView extends VBoxView { initialize(parameters: any) { super.initialize(parameters); - const pWidget = (this.pWidget as any) as JupyterPhosphorSplitPanelWidget; + const pWidget = (this.pWidget as any) as JupyterLuminoSplitPanelWidget; this.model.on('change:orientation', () => { const orientation = this.model.get('orientation'); pWidget.orientation = orientation; From 7c42ce8acfcb7639ea869807e3541e1949e7042e Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Sat, 29 Feb 2020 17:26:16 +0100 Subject: [PATCH 2/2] Fix imports for backward-compatible ipywidgets 7.x --- src/widgets/split_panel.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/widgets/split_panel.ts b/src/widgets/split_panel.ts index 5cee170f..1c7eaf7e 100644 --- a/src/widgets/split_panel.ts +++ b/src/widgets/split_panel.ts @@ -1,7 +1,7 @@ // Copyright (c) Jeremy Tuloup // Distributed under the terms of the Modified BSD License. -import { JupyterLuminoWidget, DOMWidgetView } from '@jupyter-widgets/base'; +import { JupyterPhosphorWidget, DOMWidgetView } from '@jupyter-widgets/base'; import { VBoxView } from '@jupyter-widgets/controls'; @@ -16,7 +16,7 @@ import { PanelModel } from './panel'; import { MODULE_NAME, MODULE_VERSION } from '../version'; class JupyterLuminoSplitPanelWidget extends SplitPanel { - constructor(options: JupyterLuminoWidget.IOptions & SplitPanel.IOptions) { + constructor(options: JupyterPhosphorWidget.IOptions & SplitPanel.IOptions) { let view = options.view; delete options.view; super(options); @@ -26,7 +26,7 @@ class JupyterLuminoSplitPanelWidget extends SplitPanel { processMessage(msg: Message) { super.processMessage(msg); - this._view.processLuminoMessage(msg); + this._view.processPhosphorMessage(msg); } dispose() {