mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
fix event hookup for kernel changed
event is kernel_created.Session The spec name on the kernel also wasn't being changed when the kernel changed.
This commit is contained in:
parent
17826aa0f9
commit
c1a664dfb9
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user