How to use @jupyterlab/imageviewer - 4 common examples

To help you get started, we’ve selected a few @jupyterlab/imageviewer 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 / packages / imageviewer-extension / src / index.ts View on Github external
function activate(
  app: JupyterFrontEnd,
  palette: ICommandPalette | null,
  restorer: ILayoutRestorer | null
): IImageTracker {
  const namespace = 'image-widget';
  const factory = new ImageViewerFactory({
    name: FACTORY,
    modelName: 'base64',
    fileTypes: FILE_TYPES,
    defaultFor: FILE_TYPES,
    readOnly: true
  });
  const tracker = new WidgetTracker>({
    namespace
  });

  if (restorer) {
    // Handle state restoration.
    void restorer.restore(tracker, {
      command: 'docmanager:open',
      args: widget => ({ path: widget.context.path, factory: FACTORY }),
      name: widget => widget.context.path
github jupyterlab / jupyterlab-data-explorer / packages / imageviewer-extension / src / index.ts View on Github external
function activate(
  app: JupyterFrontEnd,
  palette: ICommandPalette | null,
  restorer: ILayoutRestorer | null
): IImageTracker {
  const namespace = 'image-widget';
  const factory = new ImageViewerFactory({
    name: FACTORY,
    modelName: 'base64',
    fileTypes: FILE_TYPES,
    defaultFor: FILE_TYPES,
    readOnly: true
  });
  const tracker = new InstanceTracker>({
    namespace
  });

  if (restorer) {
    // Handle state restoration.
    restorer.restore(tracker, {
      command: 'docmanager:open',
      args: widget => ({ path: widget.context.path, factory: FACTORY }),
      name: widget => widget.context.path
github jupyterlab / jupyterlab-data-explorer / tests / test-imageviewer / src / widget.spec.ts View on Github external
it('should create an image document widget', () => {
      const factory = new ImageViewerFactory({
        name: 'Image',
        modelName: 'base64',
        fileTypes: ['png'],
        defaultFor: ['png']
      });
      const context = createFileContext(IMAGE.path);
      const d = factory.createNew(context);
      expect(d).to.be.an.instanceof(DocumentWidget);
      expect(d.content).to.be.an.instanceof(ImageViewer);
    });
  });
github jupyterlab / jupyterlab / tests / test-imageviewer / src / widget.spec.ts View on Github external
it('should create an image document widget', () => {
      const factory = new ImageViewerFactory({
        name: 'Image',
        modelName: 'base64',
        fileTypes: ['png'],
        defaultFor: ['png']
      });
      const context = createFileContext(IMAGE.path);
      const d = factory.createNew(context);
      expect(d).to.be.an.instanceof(DocumentWidget);
      expect(d.content).to.be.an.instanceof(ImageViewer);
    });
  });

@jupyterlab/imageviewer

JupyterLab - Image Widget

BSD-3-Clause
Latest version published 16 days ago

Package Health Score

89 / 100
Full package analysis

Popular @jupyterlab/imageviewer functions

Similar packages