diff --git a/IPython/html/static/notebook/js/kernelselector.js b/IPython/html/static/notebook/js/kernelselector.js index 46d4882..bf78b7c 100644 --- a/IPython/html/static/notebook/js/kernelselector.js +++ b/IPython/html/static/notebook/js/kernelselector.js @@ -85,6 +85,7 @@ define([ this.events.on('spec_changed.Kernel', function(event, data) { that.current_selection = data.name; that.element.find("#current_kernel_spec").find('.kernel_name').text(data.display_name); + that.element.find("#current_kernel_logo").attr("src", "/kernelspecs/"+data.name+"/logo-32.png"); }); this.events.on('kernel_created.Session', function(event, data) { diff --git a/IPython/html/templates/notebook.html b/IPython/html/templates/notebook.html index 3cf4b0e..45787a6 100644 --- a/IPython/html/templates/notebook.html +++ b/IPython/html/templates/notebook.html @@ -42,6 +42,7 @@ class="notebook_app" </span> <span id="kernel_selector_widget" class="pull-right dropdown"> + <img id="current_kernel_logo" src="/kernelspecs/python/logo-32.png"/> <button class="dropdown-toggle btn btn-sm navbar-btn" data-toggle="dropdown" type='button' id="current_kernel_spec"> <span class='kernel_name'>Kernel</span> <span class="caret"></span> diff --git a/IPython/kernel/kernelspec.py b/IPython/kernel/kernelspec.py index 58d3250..6424f34 100644 --- a/IPython/kernel/kernelspec.py +++ b/IPython/kernel/kernelspec.py @@ -109,8 +109,7 @@ class KernelSpecManager(HasTraits): @property def _native_kernel_resource_dir(self): - # TODO: This may be different when we actually have any resources - return os.path.dirname(__file__) + return pjoin(os.path.dirname(__file__), 'resources') def find_kernel_specs(self): """Returns a dict mapping kernel names to resource directories.""" @@ -128,7 +127,8 @@ class KernelSpecManager(HasTraits): Raises :exc:`NoSuchKernel` if the given kernel name is not found. """ if kernel_name in {'python', NATIVE_KERNEL_NAME}: - return KernelSpec(self._native_kernel_resource_dir, **self._native_kernel_dict) + return KernelSpec(resource_dir=self._native_kernel_resource_dir, + **self._native_kernel_dict) d = self.find_kernel_specs() try: @@ -187,7 +187,9 @@ class KernelSpecManager(HasTraits): os.makedirs(path, mode=0o755) with open(pjoin(path, 'kernel.json'), 'w') as f: json.dump(self._native_kernel_dict, f, indent=1) - # TODO: Copy icons into directory + copy_from = self._native_kernel_resource_dir + for file in os.listdir(copy_from): + shutil.copy(pjoin(copy_from, file), path) return path def find_kernel_specs(): diff --git a/IPython/kernel/resources/logo-32.png b/IPython/kernel/resources/logo-32.png new file mode 100644 index 0000000000000000000000000000000000000000..2877c9dcd90aaaf7851458beb3a0ba16ee1cbfdd GIT binary patch literal 1128 zc$@)f1eg1XP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004b3#c}2nYxW zd<bNS00009a7bBm0003p0003p0qGKj@Bjb+8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H11La9XK~z|U?UhYzRaFqje{=48lme!vNwGl+Vq1Byd9Q?sd_@xi z(S-}65{X2Rkn#~FF^U0Al#r-VVvK?d7r;V=x+rLhis;4wh6IEXpqJZQ9x4b1L?md4 z+VbA{yWq7{C_)KIH=WhonK_x?%$YmKB+;MZ`ZfCizyJV{05G%B!2BzGp`^`4{{mnn zAmA*pOVWW`0br6avvOcM@Ca}}umXrBwG;t%1E+w)z(n8y;1x;l0^GN7<7_z_ZBn#% z?VQhhCa8UGTS-~RxfcMe;J@6ves0*)?*Js7D^|M;I3uaCD|ruTmh`Hmhk!SMWtYpa zMNYQQd!j2V9Dn*kUY_mFYm@?aFTjMwYm@&0xCuD~l$n`z87^Mz+}E;x&QUXa(#*zR z;<D;Zn`SL;S@+a#@9gJpUWUFsY2k)3Hw9p3RlpKphk9S5-viGS^?7i0SN4rK`r@8- zbARe9z*}Z^95@E#fknLqN%|2eH?uNe3b5m<n3XGim);kE_kkI}5J?Y9I`KcT9|Ny* zjV|5n44jg5R8q$c#BK#11wQP}>HN@lCN_L>H(cHW4k!mIfWc;VC-A$ZfBFE}Q$_(h zC7tZedDkC<mNqp#QRoH$vcQ_6ejaE9z6D+@+V%sdubIv`kVqy!ny|QWXUp0-$AM|U za)5D9Zx}jguxm6?;>}hAbR~!4BI-}+_qX7d0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