diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index a7c1d974e..46338900f 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -694,6 +694,13 @@ define([ // Execute a CM command selected_cell.code_mirror.execCommand('indentAuto'); } + }, + 'close-and-halt': { + cmd: i18n.msg._('shutdown kernel and close window'), + help : i18n.msg._('shutdown kernel and close window'), + handler : function(env) { + env.notebook.close_and_halt(); + } } }; diff --git a/notebook/static/notebook/js/menubar.js b/notebook/static/notebook/js/menubar.js index cd75b36c8..17a6945a2 100644 --- a/notebook/static/notebook/js/menubar.js +++ b/notebook/static/notebook/js/menubar.js @@ -231,18 +231,6 @@ define([ } }); - this.element.find('#kill_and_exit').click(function () { - var close_window = function () { - /** - * allow closing of new tabs in Chromium, impossible in FF - */ - window.open('', '_self', ''); - window.close(); - }; - // finish with close on success or failure - that.notebook.session.delete(close_window, close_window); - }); - // View this._add_celltoolbar_list(); @@ -252,7 +240,7 @@ define([ notebook: that.notebook, keyboard_manager: that.notebook.keyboard_manager}); }); - + var id_actions_dict = { '#trust_notebook' : 'trust-notebook', '#rename_notebook' : 'rename-notebook', @@ -262,6 +250,7 @@ define([ '#restart_kernel': 'confirm-restart-kernel', '#restart_clear_output': 'confirm-restart-kernel-and-clear-output', '#restart_run_all': 'confirm-restart-kernel-and-run-all-cells', + '#close_and_halt': 'close-and-halt', '#int_kernel': 'interrupt-kernel', '#cut_cell': 'cut-cell', '#copy_cell': 'copy-cell', diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index df7dc8559..1d3d61584 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -2399,6 +2399,22 @@ define([ return promise; }; + /** + * + * Halt the kernel and close the notebook window + */ + Notebook.prototype.close_and_halt = function () { + var close_window = function () { + /** + * allow closing of new tabs in Chromium, impossible in FF + */ + window.open('', '_self', ''); + window.close(); + }; + // finish with close on success or failure + this.session.delete(close_window, close_window); + }; + /** * Execute cells corresponding to the given indices. * diff --git a/notebook/templates/notebook.html b/notebook/templates/notebook.html index 19603642c..589efdd47 100644 --- a/notebook/templates/notebook.html +++ b/notebook/templates/notebook.html @@ -124,7 +124,7 @@ data-notebook-path="{{notebook_path | urlencode}}" title="{% trans %}Trust the output of this notebook{% endtrans %}"> {% trans %}Trust Notebook{% endtrans %}
-