本文整理汇总了TypeScript中@jupyterlab/mainmenu.RunMenu.addGroup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript RunMenu.addGroup方法的具体用法?TypeScript RunMenu.addGroup怎么用?TypeScript RunMenu.addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/mainmenu.RunMenu
的用法示例。
在下文中一共展示了RunMenu.addGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createRunMenu
export function createRunMenu(app: JupyterLab, menu: RunMenu): void {
const commands = menu.menu.commands;
commands.addCommand(CommandIDs.run, {
label: () => {
const noun = Private.delegateLabel(app, menu.codeRunners, 'noun');
const enabled = Private.delegateEnabled(app, menu.codeRunners, 'run')();
return `Run Selected${enabled ? ` ${noun}` : ''}`;
},
isEnabled: Private.delegateEnabled(app, menu.codeRunners, 'run'),
execute: Private.delegateExecute(app, menu.codeRunners, 'run')
});
commands.addCommand(CommandIDs.runAll, {
label: () => {
const noun = Private.delegateLabel(app, menu.codeRunners, 'noun');
const enabled = Private.delegateEnabled(
app,
menu.codeRunners,
'runAll'
)();
return `Run All${enabled ? ` ${noun}` : ''}`;
},
isEnabled: Private.delegateEnabled(app, menu.codeRunners, 'runAll'),
execute: Private.delegateExecute(app, menu.codeRunners, 'runAll')
});
commands.addCommand(CommandIDs.restartAndRunAll, {
label: () => {
const noun = Private.delegateLabel(app, menu.codeRunners, 'noun');
const enabled = Private.delegateEnabled(
app,
menu.codeRunners,
'restartAndRunAll'
)();
return `Restart Kernel and Run All${enabled ? ` ${noun}` : ''}âŚ`;
},
isEnabled: Private.delegateEnabled(
app,
menu.codeRunners,
'restartAndRunAll'
),
execute: Private.delegateExecute(app, menu.codeRunners, 'restartAndRunAll')
});
const runAllGroup = [CommandIDs.runAll, CommandIDs.restartAndRunAll].map(
command => {
return { command };
}
);
menu.addGroup([{ command: CommandIDs.run }], 0);
menu.addGroup(runAllGroup, 999);
}