Browse Source

Remove path tracker from launcher extension.

Afshin Darian 8 years ago
parent
commit
645a3f710c

+ 1 - 11
packages/launcher-extension/src/index.ts

@@ -13,10 +13,6 @@ import {
   ICommandLinker, ICommandPalette, ILayoutRestorer
 } from '@jupyterlab/apputils';
 
-import {
-  IPathTracker
-} from '@jupyterlab/filebrowser';
-
 import {
   ILauncher, LauncherModel, LauncherWidget
 } from '@jupyterlab/launcher';
@@ -39,7 +35,6 @@ const plugin: JupyterLabPlugin<ILauncher> = {
   id: 'jupyter.services.launcher',
   requires: [
     IServiceManager,
-    IPathTracker,
     ICommandPalette,
     ICommandLinker,
     ILayoutRestorer
@@ -58,15 +53,10 @@ export default plugin;
 /**
  * Activate the launcher.
  */
-function activate(app: JupyterLab, services: IServiceManager, pathTracker: IPathTracker, palette: ICommandPalette, linker: ICommandLinker, restorer: ILayoutRestorer): ILauncher {
+function activate(app: JupyterLab, services: IServiceManager, palette: ICommandPalette, linker: ICommandLinker, restorer: ILayoutRestorer): ILauncher {
   const { commands, shell } = app;
 
   let model = new LauncherModel();
-
-  // Set launcher path and track the path as it changes.
-  model.path = pathTracker.path;
-  pathTracker.pathChanged.connect(() => { model.path = pathTracker.path; });
-
   let widget = new LauncherWidget({ linker });
 
   widget.model = model;

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

@@ -63,26 +63,6 @@ const TEXT_CLASS = 'jp-LauncherWidget-text';
  */
 const ITEM_CLASS = 'jp-LauncherWidget-item';
 
-/**
- * The class name added to LauncherWidget folder node.
- */
-const FOLDER_CLASS = 'jp-LauncherWidget-folder';
-
-/**
- * The class name added for the folder icon from default-theme.
- */
-const FOLDER_ICON_CLASS = 'jp-FolderIcon';
-
-/**
- * The class name added to LauncherWidget path nodes.
- */
-const PATH_CLASS = 'jp-LauncherWidget-path';
-
-/**
- * The class name added to LauncherWidget current working directory node.
- */
-const CWD_CLASS = 'jp-LauncherWidget-cwd';
-
 /**
  * The class name added to LauncherWidget body nodes.
  */
@@ -155,20 +135,6 @@ class LauncherModel extends VDomModel implements ILauncher {
     super();
   }
 
-  /**
-   * The path to the current working directory.
-   */
-  get path(): string {
-    return this._path;
-  }
-  set path(path: string) {
-    if (path === this._path) {
-      return;
-    }
-    this._path = path;
-    this.stateChanged.emit(void 0);
-  }
-
   /**
    * Add a command item to the launcher, and trigger re-render event for parent
    * widget.
@@ -204,7 +170,6 @@ class LauncherModel extends VDomModel implements ILauncher {
   }
 
   private _items: ILauncherItem[] = [];
-  private _path: string = 'home';
 }
 
 
@@ -237,16 +202,9 @@ class LauncherWidget extends VDomWidget<LauncherModel> {
       }, [img, text]);
     });
 
-    let folderImage = h.span({
-      className: `${FOLDER_CLASS} ${FOLDER_ICON_CLASS}`
-    });
-    let p = this.model.path;
-    let pathName = p.length ? `home > ${p.replace(/\//g, ' > ')}` : 'home';
-    let path = h.span({ className: PATH_CLASS }, pathName );
-    let cwd = h.div({ className: CWD_CLASS }, [folderImage, path]);
     let body = h.div({ className: BODY_CLASS  }, toArray(children));
 
-    return h.div({ className: DIALOG_CLASS }, [cwd, body]);
+    return h.div({ className: DIALOG_CLASS }, [body]);
   }
 
   private _linker: ICommandLinker = null;

+ 1 - 27
packages/launcher/style/index.css

@@ -91,6 +91,7 @@
   padding-top: 8px;
 }
 
+
 .jp-LauncherWidget-tour {
   margin-top: 14px;
   height: 14px;
@@ -101,30 +102,3 @@
   background-position: top center;
   background-repeat: no-repeat;
 }
-
-.jp-LauncherWidget-folder {
-  margin-right: 0;
-  display: inline-block;
-  background-origin: content-box;
-  background-repeat: no-repeat;
-  clear: none;
-  padding-left: 12px;
-  height: 1em;
-  width: 1em;
-  line-height: 1em;
-}
-
-.jp-LauncherWidget-folder:empty:before {
-  content: "\00a0";
-}
-
-.jp-LauncherWidget-path {
-    padding-left: 8px;
-    color: var(--jp-ui-font-color2);
-}
-
-.jp-LauncherWidget-cwd {
-    float: left;
-    padding-top: 14px;
-    margin-right: auto;
-}