##// END OF EJS Templates
Remove unused style() function
Thomas Kluyver -
Show More
@@ -1,63 +1,59 b''
1 1 // Copyright (c) IPython Development Team.
2 2 // Distributed under the terms of the Modified BSD License.
3 3
4 4 define([
5 5 'base/js/namespace',
6 6 'jquery',
7 7 'base/js/utils',
8 8 ], function(IPython, $, utils) {
9 9 "use strict";
10 10
11 11 var KernelSelector = function(selector, notebook) {
12 12 this.selector = selector;
13 13 this.notebook = notebook;
14 14 this.kernelspecs = {};
15 15 if (this.selector !== undefined) {
16 16 this.element = $(selector);
17 this.style();
18 17 this.request_kernelspecs();
19 18 }
20 19
21 20 // For now, this is how we make this object available elsewhere
22 21 IPython.kernelselector = this;
23 22 };
24 23
25 KernelSelector.prototype.style = function() {
26 };
27
28 24 KernelSelector.prototype.request_kernelspecs = function() {
29 25 var url = utils.url_join_encode(this.notebook.base_url, 'api/kernelspecs');
30 26 $.ajax(url, {success: $.proxy(this.got_kernelspecs, this)});
31 27 };
32 28
33 29 KernelSelector.prototype.got_kernelspecs = function(data, status, xhr) {
34 30 this.kernelspecs = {};
35 31 var menu = this.element.find("#kernel_selector");
36 32 for (var i = 0; i < data.length; i++) {
37 33 var ks = data[i];
38 34 this.kernelspecs[ks.name] = ks;
39 35 var ksentry = $("<li>").attr("id", "kernel-" +ks.name).append($('<a>')
40 36 .attr('href', '#')
41 37 .click($.proxy(this.change_kernel, this, ks.name))
42 38 .text(ks.display_name));
43 39 menu.append(ksentry);
44 40 }
45 41 };
46 42
47 43 KernelSelector.prototype.change_kernel = function(kernel_name) {
48 44 if (kernel_name === this.notebook.kernel.name) {
49 45 return;
50 46 }
51 47 this.notebook.session.delete();
52 48 this.notebook.start_session(kernel_name);
53 49 };
54 50
55 51 KernelSelector.prototype.set_displayed_name = function(kernel_name) {
56 52 var ks = this.kernelspecs[kernel_name]
57 53 if (ks !== undefined) {
58 54 this.element.find("#current_kernel_spec").text(ks.display_name);
59 55 }
60 56 };
61 57
62 58 return {'KernelSelector': KernelSelector};
63 59 });
General Comments 0
You need to be logged in to leave comments. Login now