本文整理汇总了TypeScript中jupyter-js-ui/lib/dialog.showDialog函数的典型用法代码示例。如果您正苦于以下问题:TypeScript showDialog函数的具体用法?TypeScript showDialog怎么用?TypeScript showDialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showDialog函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: trustNotebook
function trustNotebook(model: INotebookModel, host?: HTMLElement): Promise<void> {
// Do nothing if already trusted.
let cells = model.cells;
let trusted = true;
for (let i = 0; i < cells.length; i++) {
let cell = cells.get(i);
if (!cell.getMetadata('trusted').getValue()) {
trusted = false;
}
}
if (trusted) {
return Promise.resolve(void 0);
}
return showDialog({
host: host || document.body,
body: TRUST_MESSAGE,
title: 'Trust this notebook?'
}).then(result => {
if (result.text === 'OK') {
for (let i = 0; i < cells.length; i++) {
let cell = cells.get(i);
cell.getMetadata('trusted').setValue(true);
}
}
});
}
开发者ID:afshin,项目名称:jupyter-js-notebook,代码行数:26,代码来源:trust.ts
示例2: selectKernel
function selectKernel(host: HTMLElement, kernelName: string, specs: IKernelSpecIds): Promise<string> {
let selector = document.createElement('select');
let options: HTMLOptionElement[] = [];
for (let name in specs.kernelspecs) {
let option = document.createElement('option');
option.value = name;
option.text = specs.kernelspecs[name].spec.display_name;
options.push(option);
}
options.sort((a, b) => { return a.text.localeCompare(b.text); });
for (let option of options) {
selector.appendChild(option);
}
if (kernelName !== 'unknown') {
selector.value = kernelName;
} else {
selector.value = specs.kernelspecs[specs.default].spec.display_name;
}
return showDialog({
title: 'Select Kernel',
host,
body: selector
}).then(result => {
if (result.text === 'OK') {
return selector.value;
}
return null;
});
}
开发者ID:SimonBiggs,项目名称:jupyter-js-notebook,代码行数:29,代码来源:index.ts
示例3: selectKernel
function selectKernel(host: HTMLElement, model: INotebookModel, specs: IKernelSpecIds): Promise<IKernel> {
let selector = document.createElement('select');
let options: HTMLOptionElement[] = [];
for (let name in specs.kernelspecs) {
let option = document.createElement('option');
option.value = name;
option.text = specs.kernelspecs[name].spec.display_name;
options.push(option);
}
options.sort((a, b) => { return a.text.localeCompare(b.text); });
for (let option of options) {
selector.appendChild(option);
}
if (model.session) {
selector.value = model.session.kernel.name;
} else if (model.metadata && model.metadata.kernelspec) {
selector.value = model.metadata.kernelspec.name;
} else {
selector.value = specs.kernelspecs[specs.default].spec.display_name;
}
return showDialog({
title: 'Select Kernel',
host,
body: selector
}).then(result => {
if (result.text === 'OK') {
if (model.session.kernel.name !== selector.value) {
return model.session.changeKernel(selector.value);
}
}
return model.session.kernel;
});
}
开发者ID:ellisonbg,项目名称:jupyter-js-notebook,代码行数:33,代码来源:selector.ts
示例4: showDialog
handler: () => {
let msg = 'The quick brown fox jumped over the lazy dog'
showDialog({
title: 'Cool Title',
body: msg,
buttons: [okButton]
});
}
开发者ID:blink1073,项目名称:jupyter-js-ui,代码行数:8,代码来源:index.ts
示例5: dropdownDemo
/**
* Create a non-functional drop down demo.
*/
function dropdownDemo(): void {
let selector = document.createElement('select');
let option0 = document.createElement('option');
option0.value = 'python';
option0.text = 'Python 3';
selector.appendChild(option0);
let option1 = document.createElement('option');
option1.value = 'julia';
option1.text = 'Julia';
selector.appendChild(option1);
showDialog({
title: 'Select Kernel',
body: selector,
});
}
开发者ID:dwillmer,项目名称:jupyter-js-ui,代码行数:18,代码来源:index.ts
示例6: dialogDemo
/**
* Create a non-functional dialog demo.
*/
function dialogDemo(): void {
let body = document.createElement('div');
let input = document.createElement('input');
input.value = 'Untitled.ipynb'
let selector = document.createElement('select');
let option0 = document.createElement('option');
option0.value = 'python';
option0.text = 'Python 3';
selector.appendChild(option0);
let option1 = document.createElement('option');
option1.value = 'julia';
option1.text = 'Julia';
selector.appendChild(option1);
body.appendChild(input);
body.appendChild(selector);
showDialog({
title: 'Create new notebook',
body,
});
}
开发者ID:blink1073,项目名称:jupyter-js-ui,代码行数:23,代码来源:index.ts
注:本文中的jupyter-js-ui/lib/dialog.showDialog函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论