##// END OF EJS Templates
fix new-notebook and change-kernel menus...
Min RK -
Show More
@@ -2,10 +2,11 b''
2 2 // Distributed under the terms of the Modified BSD License.
3 3
4 4 define([
5 'base/js/namespace',
6 5 'jquery',
6 'base/js/namespace',
7 'base/js/dialog',
7 8 'base/js/utils',
8 ], function(IPython, $, utils) {
9 ], function($, IPython, dialog, utils) {
9 10 "use strict";
10 11
11 12 var KernelSelector = function(selector, notebook) {
@@ -37,6 +38,7 b' define(['
37 38 };
38 39
39 40 KernelSelector.prototype._got_kernelspecs = function(data) {
41 var that = this;
40 42 this.kernelspecs = data.kernelspecs;
41 43 var change_kernel_submenu = $("#menu-change-kernel-submenu");
42 44 var new_notebook_submenu = $("#menu-new-notebook-submenu");
@@ -54,32 +56,34 b' define(['
54 56 }
55 57 });
56 58
57 var i, ks, ks_submenu_entry;
58 // Create the Kernel > Change kernel submenu
59 for (i = 0; i < keys.length; i++) {
60 ks = this.kernelspecs[keys[i]];
61 ks_submenu_entry = $("<li>").attr("id", "kernel-submenu-"+ks.name).append($('<a>')
62 .attr('href', '#')
63 .click(function(){
64 $.proxy(this.set_kernel, this, ks.name)
65 event.preventDefault();
66 })
67 .text(ks.spec.display_name));
68 change_kernel_submenu.append(ks_submenu_entry);
69 }
70
71 // Create the File > New Notebook submenu
72 for (i = 0; i < keys.length; i++) {
73 ks = this.kernelspecs[keys[i]];
74 ks_submenu_entry = $("<li>").attr("id", "new-notebook-submenu-"+ks.name).append($('<a>')
75 .attr('href', '#')
76 .click(function(){
77 $.proxy(this.new_notebook, this, ks.name)
78 event.preventDefault();
79 })
80 .text(ks.spec.display_name));
81 new_notebook_submenu.append(ks_submenu_entry);
82 }
59 keys.map(function (key) {
60 // Create the Kernel > Change kernel submenu
61 var ks = data.kernelspecs[key];
62 change_kernel_submenu.append(
63 $("<li>").attr("id", "kernel-submenu-"+ks.name).append(
64 $('<a>')
65 .attr('href', '#')
66 .click( function () {
67 that.set_kernel(ks.name);
68 event.preventDefault();
69 })
70 .text(ks.spec.display_name)
71 )
72 );
73 // Create the File > New Notebook submenu
74 new_notebook_submenu.append(
75 $("<li>").attr("id", "new-notebook-submenu-"+ks.name).append(
76 $('<a>')
77 .attr('href', '#')
78 .click( function () {
79 that.new_notebook(ks.name);
80 event.preventDefault();
81 })
82 .text(ks.spec.display_name)
83 )
84 );
85
86 });
83 87 // trigger loaded promise
84 88 this._finish_load();
85 89 };
General Comments 0
You need to be logged in to leave comments. Login now