How to use the @jupyterlab/apputils.Toolbar function in @jupyterlab/apputils

To help you get started, we’ve selected a few @jupyterlab/apputils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dask / dask-labextension / src / clusters.tsx View on Github external
this._activeCluster = cluster;
      this._activeClusterChanged.emit({
        name: 'cluster',
        oldValue: old,
        newValue: cluster
      });
      this.update();
    };

    const layout = (this.layout = new PanelLayout());

    this._clusterListing = new Widget();
    this._clusterListing.addClass('dask-ClusterListing');

    // Create the toolbar.
    const toolbar = new Toolbar();

    // Make a label widget for the toolbar.
    const toolbarLabel = new Widget();
    toolbarLabel.node.textContent = 'CLUSTERS';
    toolbarLabel.addClass('dask-DaskClusterManager-label');
    toolbar.addItem('label', toolbarLabel);

    // Make a refresh button for the toolbar.
    toolbar.addItem(
      'refresh',
      new ToolbarButton({
        iconClassName: 'jp-RefreshIcon jp-Icon jp-Icon-16',
        onClick: () => {
          this._updateClusterList();
        },
        tooltip: 'Refresh Cluster List'
github jupyterlab / jupyterlab / examples / cell / src / index.ts View on Github external
// Set up a completer.
  const editor = cellWidget.editor;
  const model = new CompleterModel();
  const completer = new Completer({ editor, model });
  const connector = new KernelConnector({ session });
  const handler = new CompletionHandler({ completer, connector });

  // Set the handler's editor.
  handler.editor = editor;

  // Hide the widget when it first loads.
  completer.hide();

  // Create a toolbar for the cell.
  const toolbar = new Toolbar();
  toolbar.addItem('spacer', Toolbar.createSpacerItem());
  toolbar.addItem('interrupt', Toolbar.createInterruptButton(session));
  toolbar.addItem('restart', Toolbar.createRestartButton(session));
  toolbar.addItem('name', Toolbar.createKernelNameItem(session));
  toolbar.addItem('status', Toolbar.createKernelStatusItem(session));

  // Lay out the widgets.
  const panel = new BoxPanel();
  panel.id = 'main';
  panel.direction = 'top-to-bottom';
  panel.spacing = 0;
  panel.addWidget(completer);
  panel.addWidget(toolbar);
  panel.addWidget(cellWidget);
  BoxPanel.setStretch(toolbar, 0);
  BoxPanel.setStretch(cellWidget, 1);
github jupyterlab / jupyterlab / packages / notebook / src / panel.ts View on Github external
constructor(options: NotebookPanel.IOptions) {
    super();
    this.addClass(NOTEBOOK_PANEL_CLASS);
    this.rendermime = options.rendermime;
    let contentFactory = this.contentFactory = (
      options.contentFactory || NotebookPanel.defaultContentFactory
    );

    let layout = this.layout = new BoxLayout();

    // Toolbar
    let toolbar = new Toolbar();
    toolbar.addClass(NOTEBOOK_PANEL_TOOLBAR_CLASS);

    // Notebook
    let nbOptions: Notebook.IOptions = {
      rendermime: this.rendermime,
      languagePreference: options.languagePreference,
      contentFactory: contentFactory,
      mimeTypeService: options.mimeTypeService,
      editorConfig: options.editorConfig,
    };
    let notebook = this.notebook = contentFactory.createNotebook(nbOptions);
    notebook.addClass(NOTEBOOK_PANEL_NOTEBOOK_CLASS);

    layout.addWidget(toolbar);
    layout.addWidget(this.notebook);
github jupyterlab / jupyterlab / tests / test-apputils / src / toolbar.spec.ts View on Github external
it('should construct a new toolbar widget', () => {
        const widget = new Toolbar();
        expect(widget).to.be.an.instanceof(Toolbar);
      });
github jupyterlab / jupyterlab / packages / settingeditor / src / raweditor.ts View on Github external
export function defaultsEditor(editor: Widget): Widget {
    const widget = new Widget();
    const layout = (widget.layout = new BoxLayout({ spacing: 0 }));
    const banner = new Widget();
    const bar = new Toolbar();

    banner.node.innerText = DEFAULT_TITLE;
    bar.insertItem(0, 'banner', banner);
    layout.addWidget(bar);
    layout.addWidget(editor);

    return widget;
  }
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / filebrowser / src / browser.ts View on Github external
constructor(options: FileBrowser.IOptions) {
    super();
    this.addClass(FILE_BROWSER_CLASS);
    this.id = options.id;

    const model = (this.model = options.model);
    const renderer = options.renderer;

    model.connectionFailure.connect(
      this._onConnectionFailure,
      this
    );
    this._manager = model.manager;
    this._crumbs = new BreadCrumbs({ model });
    this.toolbar = new Toolbar();

    this._directoryPending = false;
    let newFolder = new ToolbarButton({
      iconClassName: 'jp-NewFolderIcon',
      onClick: () => {
        this.createNewDirectory();
      },
      tooltip: 'New Folder'
    });

    let uploader = new Uploader({ model });

    let refresher = new ToolbarButton({
      iconClassName: 'jp-RefreshIcon',
      onClick: () => {
        void model.refresh();
github jupyterlab / jupyterlab / packages / filebrowser / src / browser.ts View on Github external
constructor(options: FileBrowser.IOptions) {
    super();
    this.addClass(FILE_BROWSER_CLASS);
    this.id = options.id;

    const model = (this.model = options.model);
    const renderer = options.renderer;

    model.connectionFailure.connect(this._onConnectionFailure, this);
    this._manager = model.manager;
    this._crumbs = new BreadCrumbs({ model });
    this.toolbar = new Toolbar();
    this._directoryPending = false;

    const newFolder = new ToolbarButton({
      iconClassName: 'jp-NewFolderIcon',
      onClick: () => {
        this.createNewDirectory();
      },
      tooltip: 'New Folder'
    });
    const uploader = new Uploader({ model });
    const refresher = new ToolbarButton({
      iconClassName: 'jp-RefreshIcon',
      onClick: () => {
        void model.refresh();
      },
      tooltip: 'Refresh File List'
github jupyterlab / debugger / src / index.ts View on Github external
const getToolbar = (): Toolbar => {
    if (!(widget instanceof ConsolePanel)) {
      return widget.toolbar;
    }
    const toolbar = widget.widgets.find(w => w instanceof Toolbar) as Toolbar;
    return toolbar ?? new Toolbar();
  };