本文整理匯總了TypeScript中@jupyterlab/application.ILabShell.widgets方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ILabShell.widgets方法的具體用法?TypeScript ILabShell.widgets怎麽用?TypeScript ILabShell.widgets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/application.ILabShell
的用法示例。
在下文中一共展示了ILabShell.widgets方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: while
execute: args => {
const path = (args.path as string) || '';
const browserForPath = Private.getBrowserForPath(path, factory);
// Check for browser not found
if (!browserForPath) {
return;
}
// Shortcut if we are using the main file browser
if (browser === browserForPath) {
labShell.activateById(browser.id);
return;
} else {
const areas: ILabShell.Area[] = ['left', 'right'];
for (let area of areas) {
const it = labShell.widgets(area);
let widget = it.next();
while (widget) {
if (widget.contains(browserForPath)) {
labShell.activateById(widget.id);
return;
}
widget = it.next();
}
}
}
}
示例2: String
execute: (args: JSONObject) => {
const cwd = args['cwd'] ? String(args['cwd']) : '';
const id = `launcher-${Private.id++}`;
const callback = (item: Widget) => {
labShell.add(item, 'main', { ref: id });
};
const launcher = new Launcher({ cwd, callback, commands });
launcher.model = model;
launcher.title.label = 'Launcher';
launcher.title.iconClass = 'jp-LauncherIcon';
let main = new MainAreaWidget({ content: launcher });
// If there are any other widgets open, remove the launcher close icon.
main.title.closable = !!toArray(labShell.widgets('main')).length;
main.id = id;
labShell.add(main, 'main', { activate: args['activate'] as boolean });
labShell.layoutModified.connect(() => {
// If there is only a launcher open, remove the close icon.
main.title.closable = toArray(labShell.widgets('main')).length > 1;
}, main);
return main;
}
示例3: contextMenuWidget
execute: () => {
const widget = contextMenuWidget();
if (!widget) {
return;
}
const { id } = widget;
const otherWidgets = toArray(labShell.widgets('main')).filter(
widget => widget.id !== id
);
closeWidgets(otherWidgets);
}
示例4:
isEnabled: () => {
// Ensure there are at least two widgets.
const iterator = labShell.widgets('main');
return !!iterator.next() && !!iterator.next();
},
示例5: toArray
labShell.layoutModified.connect(() => {
// If there is only a launcher open, remove the close icon.
main.title.closable = toArray(labShell.widgets('main')).length > 1;
}, main);
示例6: toArray
() => {
// If there is only a launcher open, remove the close icon.
main.title.closable = toArray(labShell.widgets('main')).length > 1;
},