Skip to content

Commit

Permalink
Merge pull request #6377 from jtpio/checkboxes
Browse files Browse the repository at this point in the history
Show file checkboxes by default in the file browser
  • Loading branch information
jtpio authored Apr 26, 2022
2 parents 4194024 + 9d2c500 commit 722f1d7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions packages/tree-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ import {

import { Menu, MenuBar, TabPanel } from '@lumino/widgets';

/**
* The file browser factory.
*/
const FILE_BROWSER_FACTORY = 'FileBrowser';

/**
* The file browser plugin id.
*/
const FILE_BROWSER_PLUGIN_ID = '@jupyterlab/filebrowser-extension:browser';

/**
* Plugin to add extra commands to the file browser to create
* new notebooks, files, consoles and terminals
Expand Down Expand Up @@ -101,7 +109,7 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
app: JupyterFrontEnd,
factory: IFileBrowserFactory,
translator: ITranslator,
settings: ISettingRegistry,
settingRegistry: ISettingRegistry,
toolbarRegistry: IToolbarWidgetRegistry,
manager: IRunningSessionManagers | null
): void => {
Expand Down Expand Up @@ -135,7 +143,7 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
browser,
createToolbarFactory(
toolbarRegistry,
settings,
settingRegistry,
FILE_BROWSER_FACTORY,
browserWidget.id,
translator
Expand All @@ -151,6 +159,19 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
tabPanel.tabBar.addTab(running.title);
}

// show checkboxes by default if there is no user setting override
const settings = settingRegistry.load(FILE_BROWSER_PLUGIN_ID);
Promise.all([settings, app.restored])
.then(([settings]) => {
if (settings.user.showFileCheckboxes !== undefined) {
return;
}
void settings.set('showFileCheckboxes', true);
})
.catch((reason: Error) => {
console.error(reason.message);
});

app.shell.add(tabPanel, 'main', { rank: 100 });
}
};
Expand Down
Binary file modified ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 722f1d7

Please sign in to comment.