• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript statusbar.IStatusBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@jupyterlab/statusbar.IStatusBar的典型用法代码示例。如果您正苦于以下问题:TypeScript IStatusBar类的具体用法?TypeScript IStatusBar怎么用?TypeScript IStatusBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IStatusBar类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: EditorSyntaxStatus

 activate: (
   app: JupyterFrontEnd,
   statusBar: IStatusBar,
   tracker: IEditorTracker,
   labShell: ILabShell
 ) => {
   let item = new EditorSyntaxStatus({ commands: app.commands });
   labShell.currentChanged.connect(() => {
     const current = labShell.currentWidget;
     if (current && tracker.has(current)) {
       item.model.editor = (current as IDocumentWidget<
         FileEditor
       >).content.editor;
     }
   });
   statusBar.registerStatusItem(
     '@jupyterlab/codemirror-extension:editor-syntax-status',
     {
       item,
       align: 'left',
       rank: 0,
       isActive: () =>
         labShell.currentWidget &&
         tracker.currentWidget &&
         labShell.currentWidget === tracker.currentWidget
     }
   );
 }
开发者ID:afshin,项目名称:jupyterlab,代码行数:28,代码来源:index.ts


示例2: Menu

  activate: (
    app: JupyterFrontEnd,
    statusBar: IStatusBar,
    editorTracker: IEditorTracker,
    settingRegistry: ISettingRegistry
  ) => {
    // Create a menu for switching tabs vs spaces.
    const menu = new Menu({ commands: app.commands });
    const command = 'fileeditor:change-tabs';
    const { shell } = app;
    const args: JSONObject = {
      insertSpaces: false,
      size: 4,
      name: 'Indent with Tab'
    };
    menu.addItem({ command, args });
    for (let size of [1, 2, 4, 8]) {
      let args: JSONObject = {
        insertSpaces: true,
        size,
        name: `Spaces: ${size} `
      };
      menu.addItem({ command, args });
    }

    // Create the status item.
    const item = new TabSpaceStatus({ menu });

    // Keep a reference to the code editor config from the settings system.
    const updateSettings = (settings: ISettingRegistry.ISettings): void => {
      const cached = settings.get('editorConfig').composite as Partial<
        CodeEditor.IConfig
      >;
      const config: CodeEditor.IConfig = {
        ...CodeEditor.defaultConfig,
        ...cached
      };
      item.model!.config = config;
    };
    void Promise.all([
      settingRegistry.load('@jupyterlab/fileeditor-extension:plugin'),
      app.restored
    ]).then(([settings]) => {
      updateSettings(settings);
      settings.changed.connect(updateSettings);
    });

    // Add the status item.
    statusBar.registerStatusItem(
      '@jupyterlab/fileeditor-extension:tab-space-status',
      {
        item,
        align: 'right',
        rank: 1,
        isActive: () => {
          return shell.currentWidget && editorTracker.has(shell.currentWidget);
        }
      }
    );
  }
开发者ID:alexmorley,项目名称:jupyterlab,代码行数:60,代码来源:index.ts


示例3: PathStatus

  activate: (
    app: JupyterLab,
    statusBar: IStatusBar,
    docManager: IDocumentManager
  ) => {
    let item = new PathStatus({ docManager });

    // Keep the file path widget up-to-date with the application active widget.
    item.model!.widget = app.shell.currentWidget;
    app.shell.currentChanged.connect(() => {
      item.model!.widget = app.shell.currentWidget;
    });

    statusBar.registerStatusItem(
      '@jupyterlab/docmanager-extension:path-status',
      {
        item,
        align: 'right',
        rank: 0,
        isActive: () => {
          return true;
        }
      }
    );
  }
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:25,代码来源:index.ts


示例4: SavingStatus

  activate: (
    app: JupyterLab,
    statusBar: IStatusBar,
    docManager: IDocumentManager
  ) => {
    let item = new SavingStatus({ docManager });

    // Keep the currently active widget synchronized.
    item.model!.widget = app.shell.currentWidget;
    app.shell.currentChanged.connect(
      () => (item.model!.widget = app.shell.currentWidget)
    );

    statusBar.registerStatusItem(
      '@jupyterlab.docmanager-extension:saving-status',
      {
        item,
        align: 'middle',
        isActive: () => {
          return true;
        },
        activeStateChanged: item.model!.stateChanged
      }
    );
  }
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:25,代码来源:index.ts


示例5: MemoryUsage

  activate: (app: JupyterLab, statusBar: IStatusBar) => {
    let item = new MemoryUsage();

    statusBar.registerStatusItem(
      '@jupyterlab/statusbar-extension:memory-usage-status',
      {
        item,
        align: 'left',
        rank: 2,
        isActive: () => item.model!.metricsAvailable,
        activeStateChanged: item.model!.stateChanged
      }
    );
  }
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:14,代码来源:index.ts


示例6: RunningSessions

  activate: (app: JupyterLab, statusBar: IStatusBar) => {
    const item = new RunningSessions({
      onClick: () => app.shell.activateById('jp-running-sessions'),
      serviceManager: app.serviceManager
    });

    statusBar.registerStatusItem(
      '@jupyterlab/statusbar-extension:running-sessions-status',
      {
        item,
        align: 'left',
        rank: 0
      }
    );
  }
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:15,代码来源:index.ts


示例7: FileUploadStatus

  activate: (
    app: JupyterFrontEnd,
    statusBar: IStatusBar,
    browser: IFileBrowserFactory
  ) => {
    const item = new FileUploadStatus({
      tracker: browser.tracker
    });

    statusBar.registerStatusItem(
      '@jupyterlab/filebrowser-extension:file-upload-status',
      {
        item,
        align: 'middle',
        isActive: () => {
          return !!item.model && item.model.items.length > 0;
        },
        activeStateChanged: item.model.stateChanged
      }
    );
  }
开发者ID:ellisonbg,项目名称:jupyterlab,代码行数:21,代码来源:index.ts


示例8: PathStatus

  activate: (
    _: JupyterFrontEnd,
    statusBar: IStatusBar,
    docManager: IDocumentManager,
    labShell: ILabShell
  ) => {
    const path = new PathStatus({ docManager });

    // Keep the file path widget up-to-date with the application active widget.
    path.model!.widget = labShell.currentWidget;
    labShell.currentChanged.connect(() => {
      path.model!.widget = labShell.currentWidget;
    });

    statusBar.registerStatusItem(pathStatusPlugin.id, {
      item: path,
      align: 'right',
      rank: 0,
      isActive: () => true
    });
  }
开发者ID:alexmorley,项目名称:jupyterlab,代码行数:21,代码来源:index.ts


示例9: SavingStatus

  activate: (
    _: JupyterFrontEnd,
    statusBar: IStatusBar,
    docManager: IDocumentManager,
    labShell: ILabShell
  ) => {
    const saving = new SavingStatus({ docManager });

    // Keep the currently active widget synchronized.
    saving.model!.widget = labShell.currentWidget;
    labShell.currentChanged.connect(() => {
      saving.model!.widget = labShell.currentWidget;
    });

    statusBar.registerStatusItem(savingStatusPlugin.id, {
      item: saving,
      align: 'middle',
      isActive: () => true,
      activeStateChanged: saving.model!.stateChanged
    });
  }
开发者ID:alexmorley,项目名称:jupyterlab,代码行数:21,代码来源:index.ts


示例10: KernelStatus

  activate: (
    app: JupyterLab,
    statusBar: IStatusBar,
    notebookTracker: INotebookTracker,
    consoleTracker: IConsoleTracker
  ) => {
    // When the status item is clicked, launch the kernel
    // selection dialog for the current session.
    let currentSession: IClientSession | null = null;
    const changeKernel = () => {
      if (!currentSession) {
        return;
      }
      currentSession.selectKernel();
    };

    // Create the status item.
    const item = new KernelStatus({
      onClick: changeKernel
    });

    // When the title of the active widget changes, update the label
    // of the hover text.
    const onTitleChanged = (title: Title<Widget>) => {
      item.model!.activityName = title.label;
    };

    // Keep the session object on the status item up-to-date.
    app.shell.currentChanged.connect((shell, change) => {
      const { oldValue, newValue } = change;

      // Clean up after the old value if it exists,
      // listen for changes to the title of the activity
      if (oldValue) {
        oldValue.title.changed.disconnect(onTitleChanged);
      }
      if (newValue) {
        newValue.title.changed.connect(onTitleChanged);
      }

      // Grab the session off of the current widget, if it exists.
      if (newValue && consoleTracker.has(newValue)) {
        currentSession = (newValue as ConsolePanel).session;
      } else if (newValue && notebookTracker.has(newValue)) {
        currentSession = (newValue as NotebookPanel).session;
      } else {
        currentSession = null;
      }
      item.model!.session = currentSession;
    });

    statusBar.registerStatusItem(
      '@jupyterlab/statusbar-extension:kernel-status',
      {
        item,
        align: 'left',
        rank: 1,
        isActive: () => {
          const current = app.shell.currentWidget;
          return (
            current &&
            (notebookTracker.has(current) || consoleTracker.has(current))
          );
        }
      }
    );
  }
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:67,代码来源:index.ts



注:本文中的@jupyterlab/statusbar.IStatusBar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript statusbar.StatusBar类代码示例发布时间:2022-05-28
下一篇:
TypeScript terminal.TerminalSession类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap