1 | import { IRankedMenu, RankedMenu } from '@jupyterlab/ui-components';
|
2 | import { Widget } from '@lumino/widgets';
|
3 | import { IMenuExtender } from './tokens';
|
4 | /**
|
5 | * An interface for a Kernel menu.
|
6 | */
|
7 | export interface IKernelMenu extends IRankedMenu {
|
8 | /**
|
9 | * A set storing IKernelUsers for the Kernel menu.
|
10 | */
|
11 | readonly kernelUsers: Set<IKernelMenu.IKernelUser<Widget>>;
|
12 | }
|
13 | /**
|
14 | * An extensible Kernel menu for the application.
|
15 | */
|
16 | export declare class KernelMenu extends RankedMenu implements IKernelMenu {
|
17 | /**
|
18 | * Construct the kernel menu.
|
19 | */
|
20 | constructor(options: IRankedMenu.IOptions);
|
21 | /**
|
22 | * A set storing IKernelUsers for the Kernel menu.
|
23 | */
|
24 | readonly kernelUsers: Set<IKernelMenu.IKernelUser<Widget>>;
|
25 | /**
|
26 | * Dispose of the resources held by the kernel menu.
|
27 | */
|
28 | dispose(): void;
|
29 | }
|
30 | /**
|
31 | * Namespace for IKernelMenu
|
32 | */
|
33 | export declare namespace IKernelMenu {
|
34 | /**
|
35 | * Interface for a Kernel user to register itself
|
36 | * with the IKernelMenu's semantic extension points.
|
37 | */
|
38 | interface IKernelUser<T extends Widget> extends IMenuExtender<T> {
|
39 | /**
|
40 | * A function to interrupt the kernel.
|
41 | */
|
42 | interruptKernel?: (widget: T) => Promise<void>;
|
43 | /**
|
44 | * A function to reconnect to the kernel
|
45 | */
|
46 | reconnectToKernel?: (widget: T) => Promise<void>;
|
47 | /**
|
48 | * A function to restart the kernel, which
|
49 | * returns a promise of whether the kernel was restarted.
|
50 | */
|
51 | restartKernel?: (widget: T) => Promise<boolean>;
|
52 | /**
|
53 | * A function to restart the kernel and clear the widget, which
|
54 | * returns a promise of whether the kernel was restarted.
|
55 | */
|
56 | restartKernelAndClear?: (widget: T) => Promise<boolean>;
|
57 | /**
|
58 | * A function to change the kernel.
|
59 | */
|
60 | changeKernel?: (widget: T) => Promise<void>;
|
61 | /**
|
62 | * A function to shut down the kernel.
|
63 | */
|
64 | shutdownKernel?: (widget: T) => Promise<void>;
|
65 | /**
|
66 | * A function to return the label associated to the `restartKernelAndClear` action.
|
67 | *
|
68 | * This function receives the number of items `n` to be able to provided
|
69 | * correct pluralized forms of translations.
|
70 | */
|
71 | restartKernelAndClearLabel?: (n: number) => string;
|
72 | }
|
73 | }
|