Skip to content

Clean up interface switcher plugin in preparation for release #6766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 14, 2023
16 changes: 5 additions & 11 deletions packages/lab-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ interface ISwitcherChoice {
/**
* A plugin to add custom toolbar items to the notebook page
*/
const launchButtons: JupyterFrontEndPlugin<void> = {
const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
id: '@jupyter-notebook/lab-extension:interface-switcher',
autoStart: true,
requires: [ITranslator],
requires: [ITranslator, INotebookTracker],
optional: [
INotebookTracker,
ICommandPalette,
INotebookShell,
ILabShell,
Expand All @@ -63,17 +62,12 @@ const launchButtons: JupyterFrontEndPlugin<void> = {
activate: (
app: JupyterFrontEnd,
translator: ITranslator,
notebookTracker: INotebookTracker | null,
notebookTracker: INotebookTracker,
palette: ICommandPalette | null,
notebookShell: INotebookShell | null,
labShell: ILabShell | null,
toolbarRegistry: IToolbarWidgetRegistry | null
) => {
if (!notebookTracker) {
// to prevent showing the toolbar button in non-notebook pages
return;
}

const { commands, shell } = app;
const baseUrl = PageConfig.getBaseUrl();
const trans = translator.load('notebook');
Expand All @@ -82,7 +76,7 @@ const launchButtons: JupyterFrontEndPlugin<void> = {
};
const menubar = new MenuBar(overflowOptions);
const switcher = new Menu({ commands });
switcher.title.label = trans.__('Interface');
switcher.title.label = trans.__('Interface');
menubar.addMenu(switcher);

const isEnabled = () => {
Expand Down Expand Up @@ -182,7 +176,7 @@ const launchNotebookTree: JupyterFrontEndPlugin<void> = {
*/
const plugins: JupyterFrontEndPlugin<any>[] = [
launchNotebookTree,
launchButtons
interfaceSwitcher
];

export default plugins;