Created
May 5, 2021 19:29
-
-
Save prio/53f8a96539b6bcf85db0b0fc986801bd to your computer and use it in GitHub Desktop.
An example of a left side panel extension for Jupyterlab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
JupyterFrontEnd, | |
JupyterFrontEndPlugin, | |
ILabShell | |
} from '@jupyterlab/application'; | |
import { Widget } from '@lumino/widgets'; | |
/** | |
* Initialization data for the jupyterlab-sidepanel extension. | |
*/ | |
const extension: JupyterFrontEndPlugin<void> = { | |
id: 'jupyterlab-sidepanel:plugin', | |
autoStart: true, | |
requires: [ILabShell], | |
activate: (app: JupyterFrontEnd, shell: ILabShell) => { | |
console.log('JupyterLab extension jupyterlab_apod is activated!'); | |
// Create a blank content widget inside of a MainAreaWidget | |
const widget = new Widget(); | |
widget.id = '@jupyterlab-sidepanel/example'; | |
widget.title.iconClass = "jp-SpreadsheetIcon jp-SideBar-tabIcon"; | |
widget.title.caption = "Side Panel"; | |
let summary = document.createElement('p'); | |
widget.node.appendChild(summary); | |
summary.innerText = "Hello, World!"; | |
shell.add(widget, 'left'); | |
} | |
}; | |
export default extension; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment