Pārlūkot izejas kodu

Initial work on kernel icons in launcher.

Brian E. Granger 8 gadi atpakaļ
vecāks
revīzija
3287bd6e94

+ 8 - 1
packages/launcher/src/index.ts

@@ -165,6 +165,8 @@ interface ILauncherItem {
    * The default rank is `Infinity`.
    */
   rank?: number;
+
+  kernelIconUrl?: string;
 }
 
 
@@ -261,7 +263,12 @@ class LauncherWidget extends VDomRenderer<LauncherModel> {
         });
       };
       let imageClass = `${item.iconClass} ${IMAGE_CLASS}`;
-      let icon = h.div({ className: imageClass, onclick }, item.iconLabel);
+      let icon;
+      if (item.kernelIconUrl) {
+        icon = h.img({ src: item.kernelIconUrl, onclick }, item.iconLabel);
+      } else {
+        icon = h.div({ className: imageClass, onclick }, item.iconLabel);
+      }
       let title = item.displayName + (item.category ? ' ' + item.category : '');
       let text = h.span({className: TEXT_CLASS, onclick, title }, title);
       return h.div({

+ 6 - 0
packages/launcher/style/index.css

@@ -96,6 +96,12 @@
   transition: .2s box-shadow;
 }
 
+.jp-LauncherWidget-item img {
+  width: 64px;
+  height: 64px;
+  margin-left: auto;
+  margin-right: auto;
+}
 
 .jp-LauncherWidget-item:hover {
   box-shadow: 0px 2px 4px 1px rgba(0,0,0,.20);

+ 2 - 1
packages/notebook-extension/src/index.ts

@@ -451,7 +451,8 @@ function activateNotebookHandler(app: JupyterLab, services: IServiceManager, mai
           name,
           iconClass: 'jp-ImageNotebook',
           callback,
-          rank
+          rank,
+          kernelIconUrl: specs.kernelspecs[name].resources["logo-64x64"]
         });
       }
     });