##// END OF EJS Templates
fix kill_and_exit button in notebook
Zachary Sailer -
Show More
@@ -20,7 +20,7 var IPython = (function (IPython) {
20 "use strict";
20 "use strict";
21
21
22 /**
22 /**
23 * A MenuBar Class to generate the menubar of IPython noteboko
23 * A MenuBar Class to generate the menubar of IPython notebook
24 * @Class MenuBar
24 * @Class MenuBar
25 *
25 *
26 * @constructor
26 * @constructor
@@ -110,8 +110,8 var IPython = (function (IPython) {
110 this.element.find('#restore_checkpoint').click(function () {
110 this.element.find('#restore_checkpoint').click(function () {
111 });
111 });
112 this.element.find('#kill_and_exit').click(function () {
112 this.element.find('#kill_and_exit').click(function () {
113 IPython.notebook.kernel.kill();
113 IPython.notebook.session.delete_session();
114 setTimeout(function(){window.close();}, 200);
114 setTimeout(function(){window.close();}, 500);
115 });
115 });
116 // Edit
116 // Edit
117 this.element.find('#cut_cell').click(function () {
117 this.element.find('#cut_cell').click(function () {
@@ -17,6 +17,7 var IPython = (function (IPython) {
17 this.session_id = null;
17 this.session_id = null;
18 this.notebook_path = notebook_path;
18 this.notebook_path = notebook_path;
19 this.notebook = Notebook;
19 this.notebook = Notebook;
20 this._baseProjectUrl = Notebook.baseProjectUrl()
20 };
21 };
21
22
22 Session.prototype.start = function(){
23 Session.prototype.start = function(){
@@ -64,7 +65,22 var IPython = (function (IPython) {
64
65
65 Session.prototype.interrupt_kernel = function() {
66 Session.prototype.interrupt_kernel = function() {
66 this.kernel.interrupt();
67 this.kernel.interrupt();
67 }
68 };
69
70 Session.prototype.delete_session = function() {
71 var settings = {
72 processData : false,
73 cache : false,
74 type : "DELETE",
75 dataType : "json",
76 };
77 var url = this._baseProjectUrl + 'api/sessions/' + this.session_id;
78 $.ajax(url, settings);
79 };
80
81 Session.prototype.kill_kernel = function() {
82 this.kernel.kill();
83 };
68
84
69 IPython.Session = Session;
85 IPython.Session = Session;
70
86
@@ -111,7 +111,6 var IPython = (function (IPython) {
111 success : $.proxy(this.sessions_loaded, this)
111 success : $.proxy(this.sessions_loaded, this)
112 };
112 };
113 var url = this.baseProjectUrl() + 'api/sessions';
113 var url = this.baseProjectUrl() + 'api/sessions';
114 console.log("THIS IS A TEST");
115 $.ajax(url,settings);
114 $.ajax(url,settings);
116 };
115 };
117
116
General Comments 0
You need to be logged in to leave comments. Login now