1 |
|
2 |
|
3 |
|
4 | import { IWidgetTracker } from '@jupyterlab/apputils';
|
5 | import { Cell } from '@jupyterlab/cells';
|
6 | import { Token } from '@lumino/coreutils';
|
7 | import { ISignal } from '@lumino/signaling';
|
8 | import { Widget } from '@lumino/widgets';
|
9 | import { NotebookTools } from './notebooktools';
|
10 | import { NotebookPanel } from './panel';
|
11 | import { NotebookWidgetFactory } from './widgetfactory';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export const INotebookWidgetFactory = new Token<NotebookWidgetFactory.IFactory>(
|
17 | '@jupyterlab/notebook:INotebookWidgetFactory',
|
18 | 'A service to create the notebook viewer.'
|
19 | );
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export const INotebookTools = new Token<INotebookTools>(
|
25 | '@jupyterlab/notebook:INotebookTools',
|
26 | `A service for the "Notebook Tools" panel in the
|
27 | right sidebar. Use this to add your own functionality to the panel.`
|
28 | );
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export interface INotebookTools extends Widget {
|
34 | activeNotebookPanel: NotebookPanel | null;
|
35 | activeCell: Cell | null;
|
36 | selectedCells: Cell[];
|
37 | addItem(options: NotebookTools.IAddOptions): void;
|
38 | addSection(options: NotebookTools.IAddSectionOptions): void;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | export namespace INotebookTools {
|
45 | |
46 |
|
47 |
|
48 | export interface IAddOptions {
|
49 | |
50 |
|
51 |
|
52 | tool: ITool;
|
53 |
|
54 | |
55 |
|
56 |
|
57 | section: 'advanced' | string;
|
58 |
|
59 | |
60 |
|
61 |
|
62 | rank?: number;
|
63 | }
|
64 |
|
65 | |
66 |
|
67 |
|
68 | export interface IAddSectionOptions {
|
69 | |
70 |
|
71 |
|
72 | sectionName: string;
|
73 |
|
74 | |
75 |
|
76 |
|
77 | tool?: INotebookTools.ITool;
|
78 |
|
79 | |
80 |
|
81 |
|
82 | label?: string;
|
83 |
|
84 | |
85 |
|
86 |
|
87 | rank?: number;
|
88 | }
|
89 |
|
90 | export interface ITool extends Widget {
|
91 | |
92 |
|
93 |
|
94 | notebookTools: INotebookTools;
|
95 | }
|
96 | }
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | export const INotebookTracker = new Token<INotebookTracker>(
|
102 | '@jupyterlab/notebook:INotebookTracker',
|
103 | `A widget tracker for notebooks.
|
104 | Use this if you want to be able to iterate over and interact with notebooks
|
105 | created by the application.`
|
106 | );
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | export interface INotebookTracker extends IWidgetTracker<NotebookPanel> {
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | readonly activeCell: Cell | null;
|
119 |
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | readonly activeCellChanged: ISignal<this, Cell | null>;
|
127 |
|
128 | |
129 |
|
130 |
|
131 | readonly selectionChanged: ISignal<this, void>;
|
132 | }
|