Просмотр исходного кода

Refactor notebook plugin to have token and interface defined in implementation instead of in plugin.

Afshin Darian 8 лет назад
Родитель
Сommit
252cba7f50
3 измененных файлов с 35 добавлено и 23 удалено
  1. 1 0
      src/notebook/index.ts
  2. 4 23
      src/notebook/plugin.ts
  3. 30 0
      src/notebook/tracker.ts

+ 1 - 0
src/notebook/index.ts

@@ -2,3 +2,4 @@
 // Distributed under the terms of the Modified BSD License.
 
 export * from './notebook/index';
+export * from './tracker';

+ 4 - 23
src/notebook/plugin.ts

@@ -1,10 +1,6 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-import {
-  Token
-} from 'phosphor/lib/core/token';
-
 import {
   Menu
 } from 'phosphor/lib/ui/menu';
@@ -26,7 +22,8 @@ import {
 } from '../mainmenu';
 
 import {
-  IDocumentRegistry, restartKernel, selectKernelForContext, IWidgetFactoryOptions
+  IDocumentRegistry, IWidgetFactoryOptions,
+  restartKernel, selectKernelForContext
 } from '../docregistry';
 
 import {
@@ -46,7 +43,8 @@ import {
 } from '../widgettracker';
 
 import {
-  NotebookPanel, NotebookModelFactory, NotebookWidgetFactory, NotebookActions
+  INotebookTracker, NotebookPanel, NotebookModelFactory,
+  NotebookWidgetFactory, NotebookActions
 } from './index';
 
 
@@ -60,7 +58,6 @@ const PORTRAIT_ICON_CLASS = 'jp-MainAreaPortraitIcon';
  */
 const NOTEBOOK_ICON_CLASS = 'jp-ImageNotebook';
 
-
 /**
  * The map of command ids used by the notebook.
  */
@@ -106,22 +103,6 @@ const cmdIds = {
 };
 
 
-/* tslint:disable */
-/**
- * The notebook tracker token.
- */
-export
-const INotebookTracker = new Token<INotebookTracker>('jupyter.services.notebook-handler');
-/* tslint:enable */
-
-
-/**
- * A class that tracks notebook widgets.
- */
-export
-interface INotebookTracker extends WidgetTracker<NotebookPanel> { }
-
-
 /**
  * The notebook widget tracker provider.
  */

+ 30 - 0
src/notebook/tracker.ts

@@ -0,0 +1,30 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
+import {
+  Token
+} from 'phosphor/lib/core/token';
+
+import {
+  WidgetTracker
+} from '../widgettracker';
+
+import {
+  NotebookPanel
+} from './';
+
+
+/* tslint:disable */
+/**
+ * The notebook tracker token.
+ */
+export
+const INotebookTracker = new Token<INotebookTracker>('jupyter.services.notebook-handler');
+/* tslint:enable */
+
+
+/**
+ * A class that tracks notebook widgets.
+ */
+export
+interface INotebookTracker extends WidgetTracker<NotebookPanel> {}