##// END OF EJS Templates
s/current_selection/default_kernel/
Min RK -
Show More
@@ -14,7 +14,7 b' define(['
14 this.base_url = options.base_url;
14 this.base_url = options.base_url;
15 this.notebook_path = options.notebook_path;
15 this.notebook_path = options.notebook_path;
16 this.contents = options.contents;
16 this.contents = options.contents;
17 this.current_selection = null;
17 this.default_kernel = null;
18 this.config = options.config;
18 this.config = options.config;
19 this.kernelspecs = {};
19 this.kernelspecs = {};
20 if (this.selector !== undefined) {
20 if (this.selector !== undefined) {
@@ -74,20 +74,20 b' define(['
74 NewNotebookWidget.prototype._load_default_kernelspec = function (default_name) {
74 NewNotebookWidget.prototype._load_default_kernelspec = function (default_name) {
75 /** load default kernelspec name from config, if defined */
75 /** load default kernelspec name from config, if defined */
76 if (this.config.data.NewNotebookWidget &&
76 if (this.config.data.NewNotebookWidget &&
77 this.config.data.NewNotebookWidget.current_selection &&
77 this.config.data.NewNotebookWidget.default_kernel &&
78 this.kernelspecs[this.config.data.NewNotebookWidget.current_selection] !== undefined
78 this.kernelspecs[this.config.data.NewNotebookWidget.default_kernel] !== undefined
79 ) {
79 ) {
80 default_name = this.config.data.NewNotebookWidget.current_selection;
80 default_name = this.config.data.NewNotebookWidget.default_kernel;
81 }
81 }
82 this.set_default_kernel(default_name);
82 this.set_default_kernel(default_name);
83 };
83 };
84
84
85 NewNotebookWidget.prototype.set_default_kernel = function (kernel_name) {
85 NewNotebookWidget.prototype.set_default_kernel = function (kernel_name) {
86 /** select the current default kernel */
86 /** select the current default kernel */
87 this.current_selection = kernel_name;
87 this.default_kernel = kernel_name;
88 this.config.update({
88 this.config.update({
89 NewNotebookWidget: {
89 NewNotebookWidget: {
90 current_selection: kernel_name
90 default_kernel: kernel_name
91 }
91 }
92 });
92 });
93 var spec = this.kernelspecs[kernel_name];
93 var spec = this.kernelspecs[kernel_name];
@@ -108,7 +108,7 b' define(['
108 NewNotebookWidget.prototype.new_notebook = function (kernel_name) {
108 NewNotebookWidget.prototype.new_notebook = function (kernel_name) {
109 /** create and open a new notebook */
109 /** create and open a new notebook */
110 var that = this;
110 var that = this;
111 kernel_name = kernel_name || this.current_selection;
111 kernel_name = kernel_name || this.default_kernel;
112 var w = window.open();
112 var w = window.open();
113 this.contents.new_untitled(that.notebook_path, {type: "notebook"}).then(
113 this.contents.new_untitled(that.notebook_path, {type: "notebook"}).then(
114 function (data) {
114 function (data) {
General Comments 0
You need to be logged in to leave comments. Login now