From 566748a1f27510068a89e66e42b627af7ed5b9a7 2011-10-17 03:02:53 From: Fernando Perez <Fernando.Perez@berkeley.edu> Date: 2011-10-17 03:02:53 Subject: [PATCH] Add confirmation dialog to kernel restart action. --- diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index b67aa1a..86be02e 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -636,8 +636,26 @@ var IPython = (function (IPython) { Notebook.prototype.restart_kernel = function () { + var that = this; var notebook_id = IPython.save_widget.get_notebook_id(); - this.kernel.restart($.proxy(this.kernel_started, this)); + + var dialog = $('<div/>'); + dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.'); + $(document).append(dialog); + dialog.dialog({ + resizable: false, + modal: true, + title: "Restart kernel or continue running?", + buttons : { + "Restart": function () { + that.kernel.restart($.proxy(that.kernel_started, that)); + $(this).dialog('close'); + }, + "Continue running": function () { + $(this).dialog('close'); + } + } + }); };