本文整理汇总了TypeScript中@jupyterlab/extensionmanager.ExtensionView类的典型用法代码示例。如果您正苦于以下问题:TypeScript ExtensionView类的具体用法?TypeScript ExtensionView怎么用?TypeScript ExtensionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionView类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: async
activate: async (
app: JupyterFrontEnd,
registry: ISettingRegistry,
labShell: ILabShell | null,
restorer: ILayoutRestorer | null
) => {
const settings = await registry.load(plugin.id);
let enabled = settings.composite['enabled'] === true;
const { serviceManager, shell } = app;
let view: ExtensionView | undefined;
const createView = () => {
const v = new ExtensionView(serviceManager);
v.id = 'extensionmanager.main-view';
v.title.iconClass = 'jp-ExtensionIcon jp-SideBar-tabIcon';
v.title.caption = 'Extension Manager';
if (restorer) {
restorer.add(v, v.id);
}
return v;
};
if (enabled) {
view = createView();
shell.add(view, 'left', { rank: 1000 });
}
// If the extension is enabled or disabled,
// add or remove it from the left area.
void app.restored.then(() => {
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && (!view || (view && !view.isAttached))) {
const accepted = await Private.showWarning();
if (!accepted) {
void settings.set('enabled', false);
return;
}
view = view || createView();
shell.add(view, 'left');
} else if (!enabled && view && view.isAttached) {
view.close();
}
});
});
addCommands(app, view, labShell);
}
开发者ID:afshin,项目名称:jupyterlab,代码行数:49,代码来源:index.ts
示例2: async
activate: async (
app: JupyterLab,
registry: ISettingRegistry,
restorer: ILayoutRestorer,
router: IRouter
) => {
const settings = await registry.load(plugin.id);
let enabled = settings.composite['enabled'] === true;
const { shell, serviceManager } = app;
const view = new ExtensionView(serviceManager);
view.id = 'extensionmanager.main-view';
view.title.label = 'Extensions';
restorer.add(view, view.id);
if (enabled) {
shell.addToLeftArea(view);
}
// If the extension is enabled or disabled,
// add or remove it from the left area.
app.restored.then(() => {
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && !view.isAttached) {
const accepted = await Private.showWarning();
if (!accepted) {
settings.set('enabled', false);
return;
}
shell.addToLeftArea(view);
} else if (!enabled && view.isAttached) {
view.close();
}
});
});
addCommands(app, view);
}
开发者ID:dalejung,项目名称:jupyterlab,代码行数:40,代码来源:index.ts
示例3: if
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && !view.isAttached) {
const accepted = await Private.showWarning();
if (!accepted) {
settings.set('enabled', false);
return;
}
shell.addToLeftArea(view);
} else if (!enabled && view.isAttached) {
view.close();
}
});
开发者ID:dalejung,项目名称:jupyterlab,代码行数:13,代码来源:index.ts
示例4: createView
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && (!view || (view && !view.isAttached))) {
const accepted = await Private.showWarning();
if (!accepted) {
void settings.set('enabled', false);
return;
}
view = view || createView();
shell.add(view, 'left');
} else if (!enabled && view && view.isAttached) {
view.close();
}
});
开发者ID:afshin,项目名称:jupyterlab,代码行数:14,代码来源:index.ts
注:本文中的@jupyterlab/extensionmanager.ExtensionView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论