Browse Source

Move Jupyter Logo to application class.

This means this can’t easily be overridden anymore. If that is still needed, we can move it to a plugin in the application-extension package.
Jason Grout 4 năm trước cách đây
mục cha
commit
2e3cb5cf9b

+ 12 - 1
packages/application/src/shell.ts

@@ -3,7 +3,7 @@
 
 import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';
 
-import { classes, DockPanelSvg, LabIcon } from '@jupyterlab/ui-components';
+import { classes, DockPanelSvg, LabIcon, jupyterIcon } from '@jupyterlab/ui-components';
 
 import { ArrayExt, find, IIterator, iter, toArray } from '@lumino/algorithm';
 
@@ -298,6 +298,17 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
       rootLayout.insertWidget(2, this._menuHandler.panel);
     }
 
+    const logo = new Widget();
+    jupyterIcon.element({
+      container: logo.node,
+      elementPosition: 'center',
+      margin: '2px 2px 2px 8px',
+      height: 'auto',
+      width: '16px'
+    });
+    logo.id = 'jp-MainLogo';
+    this._topHandler.addWidget(logo, 0);
+
     // Set up single-document mode switch in menu bar
     const spacer = new Widget();
     spacer.id = 'jp-top-spacer';

+ 4 - 0
packages/application/style/base.css

@@ -61,6 +61,10 @@ body {
   border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
 }
 
+#jp-MainLogo {
+  width: calc(var(--jp-private-sidebar-tab-width) + var(--jp-border-width))
+}
+
 #jp-bottom-panel {
   background: var(--jp-layout-color1);
   display: flex;

+ 0 - 12
packages/mainmenu-extension/src/index.ts

@@ -36,8 +36,6 @@ import { ServerConnection } from '@jupyterlab/services';
 
 import { ITranslator, TranslationBundle } from '@jupyterlab/translation';
 
-import { jupyterIcon } from '@jupyterlab/ui-components';
-
 /**
  * A namespace for command IDs of semantic extension points.
  */
@@ -138,15 +136,6 @@ const plugin: JupyterFrontEndPlugin<IMainMenu> = {
     menu.id = 'jp-MainMenu';
     menu.addClass('jp-scrollbar-tiny');
 
-    const logo = new Widget();
-    jupyterIcon.element({
-      container: logo.node,
-      elementPosition: 'center',
-      margin: '2px 2px 2px 8px',
-      height: 'auto',
-      width: '16px'
-    });
-    logo.id = 'jp-MainLogo';
 
     // Only add quit button if the back-end supports it by checking page config.
     const quitButton = PageConfig.getOption('quitButton').toLowerCase();
@@ -236,7 +225,6 @@ const plugin: JupyterFrontEndPlugin<IMainMenu> = {
       });
     }
 
-    app.shell.add(logo, 'top', {rank: 0});
     app.shell.add(menu, 'menu', {rank: 100});
 
     return menu;