From 0afda7765c14dc75f90f5583c81de20bdbf16d08 2014-11-15 20:51:09 From: Thomas Kluyver Date: 2014-11-15 20:51:09 Subject: [PATCH] Merge pull request #6949 from minrk/kernel_created fix event hookup for kernel changed --- diff --git a/IPython/html/static/notebook/js/kernelselector.js b/IPython/html/static/notebook/js/kernelselector.js index 759b97e..00da819 100644 --- a/IPython/html/static/notebook/js/kernelselector.js +++ b/IPython/html/static/notebook/js/kernelselector.js @@ -76,12 +76,12 @@ define([ that.element.find("#current_kernel_spec").find('.kernel_name').text(data.display_name); }); - this.events.on('started.Session', function(events, session) { - if (session.kernel_name !== that.current_selection) { + this.events.on('kernel_created.Session', function(event, data) { + if (data.kernel.name !== that.current_selection) { // If we created a 'python' session, we only know if it's Python // 3 or 2 on the server's reply, so we fire the event again to // set things up. - var ks = that.kernelspecs[session.kernel_name]; + var ks = that.kernelspecs[data.kernel.name]; that.events.trigger('spec_changed.Kernel', ks); } }); diff --git a/IPython/html/static/services/sessions/session.js b/IPython/html/static/services/sessions/session.js index 22ba9fc..5790b6d 100644 --- a/IPython/html/static/services/sessions/session.js +++ b/IPython/html/static/services/sessions/session.js @@ -97,7 +97,9 @@ define([ Session.prototype.start = function (success, error) { var that = this; var on_success = function (data, status, xhr) { - if (!that.kernel) { + if (that.kernel) { + that.kernel.name = that.kernel_model.name; + } else { var kernel_service_url = utils.url_path_join(that.base_url, "api/kernels"); that.kernel = new kernel.Kernel(kernel_service_url, that.ws_url, that.notebook, that.kernel_model.name); }