Skip to content

Commit

Permalink
Migrate to Jupyterlab 2.0.0 (jupyterlab#116)
Browse files Browse the repository at this point in the history
Required updates to support JupyterLab 2.0.0 including
moving to Lumino JS library .

Fixes jupyterlab#121

Co-authored-by: Alex Bozarth <ajbozart@us.ibm.com>
  • Loading branch information
Martha Cryan and ajbozarth authored Mar 8, 2020
1 parent c6d6e5c commit 3062b24
Show file tree
Hide file tree
Showing 10 changed files with 1,362 additions and 1,174 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
package-lock.json
.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Here is an animation showing the extension's use, with a notebook from the [Pyth

## Prerequisites

- JupyterLab >=1.0
- JupyterLab >=2.0

## Installation

Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
]
},
"dependencies": {
"@jupyterlab/application": "^1.0.0",
"@jupyterlab/apputils": "^1.0.0",
"@jupyterlab/cells": "^1.0.0",
"@jupyterlab/coreutils": "^3.0.0",
"@jupyterlab/docmanager": "^1.0.0",
"@jupyterlab/docregistry": "^1.0.0",
"@jupyterlab/fileeditor": "^1.0.0",
"@jupyterlab/markdownviewer": "^1.0.0",
"@jupyterlab/notebook": "^1.0.0",
"@jupyterlab/rendermime": "^1.0.0",
"@phosphor/algorithm": "^1.1.3",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/messaging": "^1.2.3",
"@phosphor/widgets": "^1.8.0",
"@jupyterlab/application": "^2.0.0",
"@jupyterlab/apputils": "^2.0.0",
"@jupyterlab/cells": "^2.0.0",
"@jupyterlab/coreutils": "^4.0.0",
"@jupyterlab/docmanager": "^2.0.0",
"@jupyterlab/docregistry": "^2.0.0",
"@jupyterlab/fileeditor": "^2.0.0",
"@jupyterlab/markdownviewer": "^2.0.0",
"@jupyterlab/notebook": "^2.0.0",
"@jupyterlab/rendermime": "^2.0.0",
"@lumino/algorithm": "^1.2.3",
"@lumino/coreutils": "^1.4.2",
"@lumino/messaging": "^1.3.3",
"@lumino/widgets": "^1.10.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
Expand Down
2 changes: 1 addition & 1 deletion src/generators/notebook/options_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class OptionsManager extends Registry.IOptionsManager {
*/
set notebookMetadata(value: [string, any]) {
if (this._notebook.currentWidget != null) {
this._notebook.currentWidget.model.metadata.set(value[0], value[1]);
this._notebook.currentWidget.model!.metadata.set(value[0], value[1]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/generators/notebook/set_collapsed_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { Cell, CodeCell, CodeCellModel } from '@jupyterlab/cells';
import { INotebookTracker } from '@jupyterlab/notebook';
import { Panel } from '@phosphor/widgets';
import { Panel } from '@lumino/widgets';
import { parseHeading } from '../../utils/parse_heading';
import { isMarkdown } from '../../utils/is_markdown';
import { isDOM } from '../../utils/is_dom';
Expand Down
12 changes: 6 additions & 6 deletions src/generators/notebook/toolbar_generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as React from 'react';
import { INotebookTracker } from '@jupyterlab/notebook';
import { JSONValue } from '@phosphor/coreutils';
import { JSONValue } from '@lumino/coreutils';
import { OptionsManager } from './options_manager';
import { TagsToolComponent } from './tagstool';

Expand Down Expand Up @@ -73,16 +73,16 @@ function toolbar(options: OptionsManager, tracker: INotebookTracker) {
tracker.currentWidget.content.activeCellChanged.connect(() => {
options.updateWidget();
});
const numbering = tracker.currentWidget.model.metadata.get(
const numbering = tracker.currentWidget.model!.metadata.get(
'toc-autonumbering'
) as boolean;
const showCode = tracker.currentWidget.model.metadata.get(
const showCode = tracker.currentWidget.model!.metadata.get(
'toc-showcode'
) as boolean;
const showMarkdown = tracker.currentWidget.model.metadata.get(
const showMarkdown = tracker.currentWidget.model!.metadata.get(
'toc-showmarkdowntxt'
) as boolean;
const showTags = tracker.currentWidget.model.metadata.get(
const showTags = tracker.currentWidget.model!.metadata.get(
'toc-showtags'
) as boolean;
options.initializeOptions(
Expand Down Expand Up @@ -144,7 +144,7 @@ function toolbar(options: OptionsManager, tracker: INotebookTracker) {
loadTags() {
const notebook = tracker.currentWidget;
if (notebook) {
const cells = notebook.model.cells;
const cells = notebook.model!.cells;
const tags = new Set<string>();
this.tags = [];
for (let i = 0; i < cells.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Distributed under the terms of the Modified BSD License.

import { IWidgetTracker } from '@jupyterlab/apputils';
import { Token } from '@phosphor/coreutils';
import { Widget } from '@phosphor/widgets';
import { Token } from '@lumino/coreutils';
import { Widget } from '@lumino/widgets';
import { IHeading } from './utils/headings';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import * as ReactDOM from 'react-dom';
import { ActivityMonitor, PathExt } from '@jupyterlab/coreutils';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
import { Message } from '@phosphor/messaging';
import { Widget } from '@phosphor/widgets';
import { Message } from '@lumino/messaging';
import { Widget } from '@lumino/widgets';
import { IHeading } from './utils/headings';
import { TableOfContentsRegistry as Registry } from './registry';
import { TOCTree } from './toc_tree';
Expand Down
2 changes: 1 addition & 1 deletion src/toc_tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the terms of the Modified BSD License.

import * as React from 'react';
import { Widget } from '@phosphor/widgets';
import { Widget } from '@lumino/widgets';
import { IHeading } from './utils/headings';
import { TableOfContentsRegistry as Registry } from './registry';
import { TOCItem } from './toc_item';
Expand Down
Loading

0 comments on commit 3062b24

Please sign in to comment.