Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message when restarting Kernel #8021

Open
Juan-132 opened this issue Mar 9, 2020 · 2 comments · May be fixed by #16265
Open

Warning message when restarting Kernel #8021

Juan-132 opened this issue Mar 9, 2020 · 2 comments · May be fixed by #16265

Comments

@Juan-132
Copy link

Juan-132 commented Mar 9, 2020

Select 'Kernel'
Choose either:

  • Restart Kernel ...
  • Restart Kernel and Clear Outputs ...
  • Restart Kernel and Run All Cells ...

Result:
Capture

Expected result:
Do not show the warning message.

I find that restarting the Kernel (and rerunning all code), is a frequent action when working with a notebook. After iterating back and forth, you want to restart with a clean slate once in a while.

As it's a frequent and common action, it believe this does not really require a warning message.
Furthermore, restarting the Kernel is not a destructive action. All code is preserved, and can be recreated by a simple rerun.
There is also the 'checkpoints' feature, if you want to revisit older code and/or results.

Can this be disabled in settings? (i've not found any option so far)
How do others feel about disabling this message by default?

@jasongrout
Copy link
Contributor

We've talked about following the common pattern of a checkbox that says "Don't show me this warning again" on such dialog boxes.

CC @tgeorgeux

@jasongrout jasongrout added this to the Future milestone Mar 9, 2020
@tgeorgeux tgeorgeux modified the milestones: Future, 3.0 Mar 12, 2020
@jasongrout jasongrout modified the milestones: 3.0, 3.1 Sep 16, 2020
@blink1073 blink1073 modified the milestones: 3.1, 4.0 Jun 15, 2021
@JasonWeill JasonWeill modified the milestones: 4.0.0, 4.1.0 Feb 1, 2023
@krassowski krassowski modified the milestones: 4.1.0, 4.2.0 Feb 5, 2024
@krassowski
Copy link
Member

Of note, the dialogs now support chekboxes (https://jupyterlab.readthedocs.io/en/stable/extension/ui_helpers.html) and "Do not ask me again" is implemented for prompt for renaming file on save and closing files without saving:

image

const result = await InputDialog.getText({
title: trans.__('Rename file'),
okLabel: trans.__('Rename'),
placeholder: trans.__('File name'),
text: oldName,
selectionRange: oldName.length - PathExt.extname(oldName).length,
checkbox: {
label: trans.__('Do not ask me again.'),
caption: trans.__(
'If checked, you will not be asked to rename future untitled files when saving them.'
)
}
});
if (result.button.accept) {
newName = result.value ?? oldName;
(widget as IDocumentWidget).isUntitled = false;
if (typeof result.isChecked === 'boolean') {
const currentSetting = (
await settingRegistry.get(
docManagerPluginId,
'renameUntitledFileOnSave'
)
).composite as boolean;
if (result.isChecked === currentSetting) {
settingRegistry
.set(
docManagerPluginId,
'renameUntitledFileOnSave',
!result.isChecked
)
.catch(reason => {
console.error(
`Fail to set 'renameUntitledFileOnSave:\n${reason}`
);
});
}
}

const confirm = await showDialog({
title: trans.__('Confirmation'),
body: trans.__('Please confirm you want to close "%1".', fileName),
checkbox: isDirty
? null
: {
label: trans.__('Do not ask me again.'),
caption: trans.__(
'If checked, no confirmation to close a document will be asked in the future.'
)
},
buttons
});
if (confirm.isChecked) {
this.confirmClosingDocument = false;
}
return Promise.resolve([
confirm.button.accept,
isDirty ? confirm.button.displayType === 'warn' : true
]);

And kernel selection dialog has "Always start the preferred kernel":

image

const hasCheckbox = typeof autoStartDefault === 'boolean';
const dialog = new Dialog({
title: trans.__('Select Kernel'),
body: new Private.KernelSelector(sessionContext, this._translator),
buttons,
checkbox: hasCheckbox
? {
label: trans.__('Always start the preferred kernel'),
caption: trans.__(
'Remember my choice and always start the preferred kernel'
),
checked: autoStartDefault
}
: null
});
const result = await dialog.launch();
if (sessionContext.isDisposed || !result.button.accept) {
return;
}
if (hasCheckbox && result.isChecked !== null) {
sessionContext.kernelPreference = {
...sessionContext.kernelPreference,
autoStartDefault: result.isChecked
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants