How to use @jupyterlab/console - 10 common examples

To help you get started, we’ve selected a few @jupyterlab/console 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 jupyterlab / jupyterlab / examples / console / src / index.ts View on Github external
function startApp(path: string, manager: ServiceManager.IManager) {
  console.log('starting app');
  // Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMimeRegistry({ initialFactories });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
  SplitPanel.setStretch(consolePanel, 1);
github jupyterlab / jupyterlab / packages / console-extension / src / index.ts View on Github external
async function createConsole(options: ICreateOptions): Promise {
    await manager.ready;

    const panel = new ConsolePanel({
      manager,
      contentFactory,
      mimeTypeService: editorServices.mimeTypeService,
      rendermime,
      setBusy: status ? status.setBusy.bind(status) : undefined,
      ...(options as Partial)
    });

    const interactionMode: string = (await settingRegistry.get(
      '@jupyterlab/console-extension:tracker',
      'interactionMode'
    )).composite as string;
    panel.console.node.dataset.jpInteractionMode = interactionMode;

    // Add the console panel to the tracker and wait for it to be ready.
    await Promise.all([tracker.add(panel), panel.session.ready]);
github jupyterlab / jupyterlab / examples / console / src / index.ts View on Github external
function startApp(path: string, manager: ServiceManager.IManager) {
  console.log('starting app');
  // Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMimeRegistry({ initialFactories });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
github jupyterlab / jupyterlab-data-explorer / jupyterlab / examples / console / src / index.ts View on Github external
function startApp(path: string, manager: ServiceManager.IManager) {
  // Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMimeRegistry({ initialFactories });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
  SplitPanel.setStretch(consolePanel, 1);
github pymedphys / pymedphys / packages / pymedphys / src / pymedphys / gui / src / jupyter.tsx View on Github external
let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  // let consoleWidget = new CodeConsole({
  //   contentFactory,
  //   rendermime,
  //   mimeTypeService: editorServices.mimeTypeService,
  //   session:
  // })
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });

  let panel = new SplitPanel();
  panel.id = 'console-panel';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(consolePanel, 1);
  panel.addWidget(consolePanel);

  // Attach the panel to the DOM.
  // Widget.attach(panel, app);
github yuvipanda / simplest-notebook / examples / console / src / index.ts View on Github external
// Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMime({
    initialFactories: defaultRendererFactories
  });

  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
  SplitPanel.setStretch(consolePanel, 1);
github yuvipanda / simplest-notebook / examples / console / src / index.ts View on Github external
// Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMime({
    initialFactories: defaultRendererFactories
  });

  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
github jupyterlab / jupyterlab-data-explorer / jupyterlab / examples / console / src / index.ts View on Github external
function startApp(path: string, manager: ServiceManager.IManager) {
  // Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMimeRegistry({ initialFactories });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
github pymedphys / pymedphys / packages / pymedphys / src / pymedphys / gui / src / jupyter.tsx View on Github external
function buildConsole(manager: ServiceManager.IManager) {
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  // let consoleWidget = new CodeConsole({
  //   contentFactory,
  //   rendermime,
  //   mimeTypeService: editorServices.mimeTypeService,
  //   session:
  // })
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });

  let panel = new SplitPanel();
  panel.id = 'console-panel';
  panel.orientation = 'horizontal';
github jupyterlab / jupyterlab / test / src / console / widget.spec.ts View on Github external
it('should create a raw cell model', () => {
          let factory = new CodeConsole.ModelFactory({});
          expect(factory.createRawCell({})).to.be.a(RawCellModel);
        });