##// END OF EJS Templates
remove UI for setting default kernel...
Min RK -
Show More
@@ -130,6 +130,7 b' require(['
130 IPython.session_list = session_list;
130 IPython.session_list = session_list;
131 IPython.kernel_list = kernel_list;
131 IPython.kernel_list = kernel_list;
132 IPython.login_widget = login_widget;
132 IPython.login_widget = login_widget;
133 IPython.new_notebook_widget = nnw;
133
134
134 events.trigger('app_initialized.DashboardApp');
135 events.trigger('app_initialized.DashboardApp');
135
136
@@ -58,16 +58,11 b' define(['
58 var li = $("<li>")
58 var li = $("<li>")
59 .attr("id", "kernel-" +ks.name)
59 .attr("id", "kernel-" +ks.name)
60 .data('kernelspec', ks).append(
60 .data('kernelspec', ks).append(
61 $('<a>').attr('href', '#').append($('<i>')
61 $('<a>')
62 .addClass('kernel-menu-icon fa')
63 .attr('href', '#')
64 .click($.proxy(this.select_kernel, this, ks.name))
65 ).append($('<span>')
66 .attr('href', '#')
62 .attr('href', '#')
67 .click($.proxy(this.new_notebook, this, ks.name))
63 .click($.proxy(this.new_notebook, this, ks.name))
68 .text(ks.display_name)
64 .text(ks.display_name)
69 .attr('title', 'Create a new notebook with ' + ks.display_name)
65 .attr('title', 'Create a new notebook with ' + ks.display_name)
70 )
71 );
66 );
72 menu.append(li);
67 menu.append(li);
73 }
68 }
@@ -77,17 +72,17 b' define(['
77 };
72 };
78
73
79 NewNotebookWidget.prototype._load_default_kernelspec = function (default_name) {
74 NewNotebookWidget.prototype._load_default_kernelspec = function (default_name) {
80 /** load default kernelspec name from localStorage, if defined */
75 /** load default kernelspec name from config, if defined */
81 if (this.config.data.NewNotebookWidget &&
76 if (this.config.data.NewNotebookWidget &&
82 this.config.data.NewNotebookWidget.current_selection &&
77 this.config.data.NewNotebookWidget.current_selection &&
83 this.kernelspecs[this.config.data.NewNotebookWidget.current_selection] !== undefined
78 this.kernelspecs[this.config.data.NewNotebookWidget.current_selection] !== undefined
84 ) {
79 ) {
85 default_name = this.config.data.NewNotebookWidget.current_selection;
80 default_name = this.config.data.NewNotebookWidget.current_selection;
86 }
81 }
87 this.select_kernel(default_name);
82 this.set_default_kernel(default_name);
88 };
83 };
89
84
90 NewNotebookWidget.prototype.select_kernel = function (kernel_name) {
85 NewNotebookWidget.prototype.set_default_kernel = function (kernel_name) {
91 /** select the current default kernel */
86 /** select the current default kernel */
92 this.current_selection = kernel_name;
87 this.current_selection = kernel_name;
93 this.config.update({
88 this.config.update({
@@ -99,33 +94,13 b' define(['
99 var display_name;
94 var display_name;
100 if (spec) {
95 if (spec) {
101 display_name = spec.display_name;
96 display_name = spec.display_name;
102 localStorage.default_kernel_name = kernel_name;
103 this.element.find("#current-kernel").text(display_name);
97 this.element.find("#current-kernel").text(display_name);
104 } else {
98 } else {
105 display_name = 'default kernel';
99 display_name = 'default kernel';
106 delete localStorage.default_kernel_name;
107 }
100 }
108 this.element.find("#new_notebook").attr('title',
101 this.element.find("#new_notebook").attr('title',
109 'Create a new notebook with ' + display_name
102 'Create a new notebook with ' + display_name
110 );
103 );
111 this.element.find("li").map(function (i, li) {
112 li = $(li);
113 var ks = li.data('kernelspec');
114 if (ks.name == kernel_name) {
115 li.find(".kernel-menu-icon")
116 .attr('title', display_name + ' is the default kernel')
117 .addClass("kernel-menu-icon-current");
118 } else {
119 li.find(".kernel-menu-icon")
120 .attr('title', 'Make ' + ks.display_name + ' the default kernel')
121 .removeClass("kernel-menu-icon-current");
122 }
123 });
124 };
125
126 NewNotebookWidget.prototype.new_with_kernel = function (kernel_name) {
127 /** record current selection and open a new notebook */
128 this.new_notebook(kernel_name);
129 };
104 };
130
105
131 NewNotebookWidget.prototype.new_notebook = function (kernel_name) {
106 NewNotebookWidget.prototype.new_notebook = function (kernel_name) {
General Comments 0
You need to be logged in to leave comments. Login now