##// END OF EJS Templates
separate selecting default kernel from new notebook with specified kernel...
Min RK -
Show More
@@ -8168,6 +8168,17 b' ul#new-notebook-menu {'
8168 left: auto;
8168 left: auto;
8169 right: 0;
8169 right: 0;
8170 }
8170 }
8171 .kernel-menu-icon {
8172 padding-right: 12px;
8173 width: 24px;
8174 content: "\f096";
8175 }
8176 .kernel-menu-icon:before {
8177 content: "\f096";
8178 }
8179 .kernel-menu-icon-current:before {
8180 content: "\f00c";
8181 }
8171 /*!
8182 /*!
8172 *
8183 *
8173 * IPython notebook
8184 * IPython notebook
@@ -43,13 +43,21 b' define(['
43 for (var i = 0; i < data.length; i++) {
43 for (var i = 0; i < data.length; i++) {
44 var ks = data[i];
44 var ks = data[i];
45 this.kernelspecs[ks.name] = ks;
45 this.kernelspecs[ks.name] = ks;
46 var ksentry = $("<li>").attr("id", "kernel-" +ks.name).append($('<a>')
46 var li = $("<li>")
47 .attr('href', '#')
47 .attr("id", "kernel-" +ks.name)
48 .click($.proxy(this.new_with_kernel, this, ks.name))
48 .data('kernelspec', ks).append(
49 .text(ks.display_name)
49 $('<a>').attr('href', '#').append($('<i>')
50 .attr('title', 'Create a new notebook with ' + ks.display_name)
50 .addClass('kernel-menu-icon fa')
51 .attr('href', '#')
52 .click($.proxy(this.select_kernel, this, ks.name))
53 ).append($('<span>')
54 .attr('href', '#')
55 .click($.proxy(this.new_notebook, this, ks.name))
56 .text(ks.display_name)
57 .attr('title', 'Create a new notebook with ' + ks.display_name)
58 )
51 );
59 );
52 menu.append(ksentry);
60 menu.append(li);
53 }
61 }
54 this._load_default_kernelspec();
62 this._load_default_kernelspec();
55 };
63 };
@@ -75,11 +83,23 b' define(['
75 this.element.find("#new_notebook").attr('title',
83 this.element.find("#new_notebook").attr('title',
76 'Create a new notebook with ' + display_name
84 'Create a new notebook with ' + display_name
77 );
85 );
86 this.element.find("li").map(function (i, li) {
87 li = $(li);
88 var ks = li.data('kernelspec');
89 if (ks.name == kernel_name) {
90 li.find(".kernel-menu-icon")
91 .attr('title', display_name + ' is the default kernel')
92 .addClass("kernel-menu-icon-current");
93 } else {
94 li.find(".kernel-menu-icon")
95 .attr('title', 'Make ' + ks.display_name + ' the default kernel')
96 .removeClass("kernel-menu-icon-current");
97 }
98 });
78 };
99 };
79
100
80 NewNotebookWidget.prototype.new_with_kernel = function (kernel_name) {
101 NewNotebookWidget.prototype.new_with_kernel = function (kernel_name) {
81 /** record current selection and open a new notebook */
102 /** record current selection and open a new notebook */
82 this.select_kernel(kernel_name);
83 this.new_notebook(kernel_name);
103 this.new_notebook(kernel_name);
84 };
104 };
85
105
@@ -159,4 +159,18 b' ul#new-notebook-menu {'
159 // align right instead of left
159 // align right instead of left
160 left: auto;
160 left: auto;
161 right: 0;
161 right: 0;
162 } No newline at end of file
162 }
163
164 .kernel-menu-icon {
165 padding-right: 12px;
166 width: 24px;
167 content: @fa-var-square-o;
168 }
169
170 .kernel-menu-icon:before {
171 content: @fa-var-square-o;
172 }
173
174 .kernel-menu-icon-current:before {
175 content: @fa-var-check;
176 }
@@ -49,7 +49,7 b' data-terminals-available="{{terminals_available}}"'
49 New Notebook
49 New Notebook
50 </button>
50 </button>
51 <button class="dropdown-toggle btn btn-default btn-xs" data-toggle="dropdown">
51 <button class="dropdown-toggle btn btn-default btn-xs" data-toggle="dropdown">
52 <span id="current-kernel"></span>
52 <span id="current-kernel">Loading...</span>
53 <span class="caret"></span>
53 <span class="caret"></span>
54 </button>
54 </button>
55 <ul id="new-notebook-menu" class="dropdown-menu"></ul>
55 <ul id="new-notebook-menu" class="dropdown-menu"></ul>
General Comments 0
You need to be logged in to leave comments. Login now