##// END OF EJS Templates
Merge pull request #6537 from takluyver/kernelspec-logos...
Min RK -
r19398:cbecd94e merge
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
@@ -85,6 +85,7 b' define(['
85 85 this.events.on('spec_changed.Kernel', function(event, data) {
86 86 that.current_selection = data.name;
87 87 that.element.find("#current_kernel_spec").find('.kernel_name').text(data.display_name);
88 that.element.find("#current_kernel_logo").attr("src", "/kernelspecs/"+data.name+"/logo-64x64.png");
88 89 });
89 90
90 91 this.events.on('kernel_created.Session', function(event, data) {
@@ -96,6 +97,14 b' define(['
96 97 that.events.trigger('spec_changed.Kernel', ks);
97 98 }
98 99 });
100
101 var logo_img = this.element.find("#current_kernel_logo")
102 logo_img.on("load", function() {
103 logo_img.show();
104 });
105 logo_img.on("error", function() {
106 logo_img.hide();
107 });
99 108 };
100 109
101 110 return {'KernelSelector': KernelSelector};
@@ -9,4 +9,9 b''
9 9 margin-top:0px;
10 10 }
11 11 }
12
13 & > img#current_kernel_logo {
14 width: 32px;
15 height: 32px;
16 }
12 17 }
@@ -9685,6 +9685,10 b' fieldset[disabled] #kernel_selector_widget > button.active {'
9685 9685 #kernel_selector_widget > button > span.caret {
9686 9686 margin-top: 0px;
9687 9687 }
9688 #kernel_selector_widget > img#current_kernel_logo {
9689 width: 32px;
9690 height: 32px;
9691 }
9688 9692 #menubar {
9689 9693 box-sizing: border-box;
9690 9694 -moz-box-sizing: border-box;
@@ -42,6 +42,7 b' class="notebook_app"'
42 42 </span>
43 43
44 44 <span id="kernel_selector_widget" class="pull-right dropdown">
45 <img id="current_kernel_logo"/>
45 46 <button class="dropdown-toggle btn btn-sm navbar-btn" data-toggle="dropdown" type='button' id="current_kernel_spec">
46 47 <span class='kernel_name'>Kernel</span>
47 48 <span class="caret"></span>
@@ -109,8 +109,7 b' class KernelSpecManager(HasTraits):'
109 109
110 110 @property
111 111 def _native_kernel_resource_dir(self):
112 # TODO: This may be different when we actually have any resources
113 return os.path.dirname(__file__)
112 return pjoin(os.path.dirname(__file__), 'resources')
114 113
115 114 def find_kernel_specs(self):
116 115 """Returns a dict mapping kernel names to resource directories."""
@@ -128,7 +127,8 b' class KernelSpecManager(HasTraits):'
128 127 Raises :exc:`NoSuchKernel` if the given kernel name is not found.
129 128 """
130 129 if kernel_name in {'python', NATIVE_KERNEL_NAME}:
131 return KernelSpec(self._native_kernel_resource_dir, **self._native_kernel_dict)
130 return KernelSpec(resource_dir=self._native_kernel_resource_dir,
131 **self._native_kernel_dict)
132 132
133 133 d = self.find_kernel_specs()
134 134 try:
@@ -187,7 +187,9 b' class KernelSpecManager(HasTraits):'
187 187 os.makedirs(path, mode=0o755)
188 188 with open(pjoin(path, 'kernel.json'), 'w') as f:
189 189 json.dump(self._native_kernel_dict, f, indent=1)
190 # TODO: Copy icons into directory
190 copy_from = self._native_kernel_resource_dir
191 for file in os.listdir(copy_from):
192 shutil.copy(pjoin(copy_from, file), path)
191 193 return path
192 194
193 195 def find_kernel_specs():
General Comments 0
You need to be logged in to leave comments. Login now