浏览代码

Remove tracker-related notifyCommandChanged, since they are covered by
the application-level instance tracker notification.

Ian Rose 7 年之前
父节点
当前提交
f06dc7299c

+ 1 - 3
packages/application-extension/src/index.tsx

@@ -86,9 +86,7 @@ const main: JupyterLabPlugin<void> = {
     // If the application shell layout is modified,
     // trigger a refresh of the commands.
     app.shell.layoutModified.connect(() => {
-      Object.keys(CommandIDs).forEach(key => {
-        app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-      });
+      app.commands.notifyCommandChanged();
     });
 
     let builder = app.serviceManager.builder;

+ 0 - 5
packages/codemirror-extension/src/index.ts

@@ -289,11 +289,6 @@ function activateEditorCommands(app: JupyterLab, tracker: IEditorTracker, mainMe
     });
   });
 
-  // Keep the rendered commands that are per-widget up to date.
-  tracker.currentChanged.connect(() => {
-    commands.notifyCommandChanged(CommandIDs.changeMode);
-  });
-
 
   // Add some of the editor settings to the settings menu.
   mainMenu.settingsMenu.addGroup([

+ 0 - 7
packages/console-extension/src/index.ts

@@ -432,13 +432,6 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     palette.addItem({ command, category });
   });
 
-  // Keep the rendered commands up-to-date.
-  tracker.currentChanged.connect(() => {
-    Object.keys(CommandIDs).forEach(key => {
-      app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-    });
-  });
-
   // Add a console creator to the File menu
   mainMenu.fileMenu.newMenu.addGroup([{ command: CommandIDs.create }], 0);
 

+ 0 - 7
packages/docmanager-extension/src/index.ts

@@ -136,13 +136,6 @@ const plugin: JupyterLabPlugin<IDocumentManager> = {
     // Register the file operations commands.
     addCommands(app, docManager, palette, opener, settingRegistry);
 
-    // Keep the registered commands up-to-date.
-    app.shell.currentChanged.connect(() => {
-      Object.keys(CommandIDs).forEach(key => {
-        app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-      });
-    });
-
     // Keep up to date with the settings registry.
     const onSettingsUpdated = (settings: ISettingRegistry.ISettings) => {
       const autosave = settings.get('autosave').composite as boolean | null;

+ 2 - 13
packages/fileeditor-extension/src/index.ts

@@ -132,15 +132,6 @@ function activate(app: JupyterLab, consoleTracker: IConsoleTracker, editorServic
     name: widget => widget.context.path
   });
 
-  /**
-   * Refresh the rendered commands.
-   */
-  const refreshCommands = () => {
-    Object.keys(CommandIDs).forEach(key => {
-      app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-    });
-  };
-
   /**
    * Update the setting values.
    */
@@ -151,7 +142,8 @@ function activate(app: JupyterLab, consoleTracker: IConsoleTracker, editorServic
       config[key] = (cached[key] === null || cached[key] === undefined) ?
         CodeEditor.defaultConfig[key] : cached[key];
     });
-    refreshCommands();
+    // Trigger a refresh of the rendered commands
+    app.commands.notifyCommandChanged();
   }
 
   /**
@@ -171,9 +163,6 @@ function activate(app: JupyterLab, consoleTracker: IConsoleTracker, editorServic
     });
   }
 
-  // Keep the rendered commands up-to-date.
-  tracker.currentChanged.connect(refreshCommands);
-
   // Add a console creator to the File menu
   // Fetch the initial state of the settings.
   Promise.all([settingRegistry.load(id), restored]).then(([settings]) => {

+ 0 - 7
packages/imageviewer-extension/src/index.ts

@@ -111,13 +111,6 @@ function activate(app: JupyterLab, palette: ICommandPalette, restorer: ILayoutRe
 
   addCommands(app, tracker);
 
-  // Keep the rendered commands up-to-date.
-  tracker.currentChanged.connect(() => {
-    Object.keys(CommandIDs).forEach(key => {
-      app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-    });
-  });
-
   const category = 'Image Viewer';
 
   [CommandIDs.zoomIn, CommandIDs.zoomOut, CommandIDs.resetImage, CommandIDs.rotateClockwise, CommandIDs.rotateCounterclockwise, CommandIDs.flipHorizontal, CommandIDs.flipVertical, CommandIDs.invertColors]

+ 0 - 8
packages/notebook-extension/src/index.ts

@@ -434,14 +434,6 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
   addCommands(app, services, tracker);
   populatePalette(palette);
 
-  // Keep the rendered commands up-to-date.
-  tracker.currentChanged.connect(() => {
-    Object.keys(CommandIDs).forEach(key => {
-      app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-    });
-  });
-
-
   let id = 0; // The ID counter for notebook panels.
 
   factory.widgetCreated.connect((sender, widget) => {

+ 0 - 7
packages/terminal-extension/src/index.ts

@@ -118,13 +118,6 @@ function activate(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette
     palette.addItem({ command, category, args: { 'isPalette': true } });
   });
 
-  // Keep the rendered commands up-to-date.
-  tracker.currentChanged.connect(() => {
-    Object.keys(CommandIDs).forEach(key => {
-      app.commands.notifyCommandChanged((CommandIDs as any)[key]);
-    });
-  });
-
   // Add terminal creation to the file menu.
   mainMenu.fileMenu.newMenu.addGroup([{ command: CommandIDs.createNew }], 20);