浏览代码

Remove docmanager demo

Steven Silvester 9 年之前
父节点
当前提交
91f7253bc2

+ 0 - 263
examples/docmanager/index.css

@@ -1,263 +0,0 @@
-/*-----------------------------------------------------------------------------
-| Copyright (c) Jupyter Development Team.
-| Distributed under the terms of the Modified BSD License.
-|----------------------------------------------------------------------------*/
-body {
-  margin: 0;
-  padding: 0;
-}
-
-
-#main {
-  position: absolute;
-  top: 10px;
-  left: 10px;
-  right: 10px;
-  bottom: 10px;
-  padding: 8px;
-}
-
-
-.p-SplitPanel {
-  height: 400px;
-}
-
-
-.p-DockTabPanel {
-  padding-right: 2px;
-  padding-bottom: 2px;
-}
-
-
-.p-DockTabPanel > .p-StackedPanel {
-  padding: 10px;
-  background: white;
-  border: 1px solid #C0C0C0;
-  border-top: none;
-  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
-}
-
-
-.p-DockPanel-overlay {
-  background: rgba(255, 255, 255, 0.6);
-  border: 1px dashed black;
-}
-
-
-.p-DockPanel-overlay.p-mod-root-top,
-.p-DockPanel-overlay.p-mod-root-left,
-.p-DockPanel-overlay.p-mod-root-right,
-.p-DockPanel-overlay.p-mod-root-bottom,
-.p-DockPanel-overlay.p-mod-root-center {
-  border-width: 2px;
-}
-
-
-.p-TabBar {
-  min-height: 24px;
-  max-height: 24px;
-}
-
-
-.p-TabBar-header {
-  display: none;
-}
-
-
-.p-TabBar-footer {
-  flex: 0 0 1px;
-  background: #C0C0C0;
-}
-
-
-.p-TabBar-content {
-  min-width: 0;
-  align-items: flex-end;
-}
-
-
-.p-TabBar-tab {
-  flex: 0 1 125px;
-  min-height: 20px;
-  max-height: 20px;
-  min-width: 35px;
-  margin-left: -1px;
-  border: 1px solid #C0C0C0;
-  border-bottom: none;
-  padding: 0px 10px;
-  background: #E5E5E5;
-  font: 12px Helvetica, Arial, sans-serif;
-}
-
-
-.p-TabBar-tab:first-child {
-  margin-left: 0;
-}
-
-
-.p-TabBar-tab.p-mod-current {
-  min-height: 23px;
-  max-height: 23px;
-  background: white;
-  transform: translateY(1px);
-}
-
-
-.p-TabBar-tab:hover:not(.p-mod-current) {
-  background: #F0F0F0;
-}
-
-
-.p-TabBar-tabIcon,
-.p-TabBar-tabText,
-.p-TabBar-tabCloseIcon {
-  line-height: 20px;
-}
-
-
-.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon {
-  margin-left: 4px;
-}
-
-
-.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before {
-  font-family: FontAwesome;
-  content: '\f00d'; /* close */
-}
-
-
-.p-TabBar-tab.p-mod-closable.jp-mod-dirty > .p-TabBar-tabCloseIcon:before {
-  font-family: FontAwesome;
-  content: '\f069'; /* asterisk */
-}
-
-
-.p-TabBar-tab.p-mod-drag-image {
-  min-height: 23px;
-  max-height: 23px;
-  min-width: 125px;
-  border: none;
-  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
-  transform: translateX(-40%) translateY(-58%);
-}
-
-.p-MenuBar {
-  padding-left: 5px;
-  background: #FAFAFA;
-  color: rgba(0, 0, 0, 0.87);
-  border-bottom: 1px solid #DDDDDD;
-  font: 13px Helvetica, Arial, sans-serif;
-}
-
-
-.p-MenuBar-menu {
-  transform: translateY(-1px);
-}
-
-
-.p-MenuBar-item {
-  padding: 4px 8px;
-  border-left: 1px solid transparent;
-  border-right: 1px solid transparent;
-}
-
-
-.p-MenuBar-item.p-mod-active {
-  background: #E5E5E5;
-}
-
-
-.p-MenuBar-item.p-mod-disabled {
-  color: rgba(0, 0, 0, 0.26);
-}
-
-
-.p-MenuBar-item.p-type-separator {
-  margin: 2px;
-  padding: 0;
-  border: none;
-  border-left: 1px solid #DDDDDD;
-}
-
-
-.p-MenuBar.p-mod-active .p-MenuBar-item.p-mod-active {
-  z-index: 10001;
-  background: white;
-  border-left: 1px solid #C0C0C0;
-  border-right: 1px solid #C0C0C0;
-  box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);
-}
-
-
-.p-Menu {
-  z-index: 10000;
-  padding: 3px 0px;
-  background: white;
-  color: rgba(0, 0, 0, 0.87);
-  border: 1px solid #C0C0C0;
-  font: 12px Helvetica, Arial, sans-serif;
-  box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2);
-}
-
-
-.p-Menu-item.p-mod-active {
-  background: #E5E5E5;
-}
-
-
-.p-Menu-item.p-mod-disabled {
-  color: rgba(0, 0, 0, 0.26);
-}
-
-
-.p-Menu-itemIcon {
-  width: 21px;
-  padding: 4px 2px;
-}
-
-
-.p-Menu-itemText {
-  padding: 4px 35px 4px 2px;
-}
-
-
-.p-Menu-itemShortcut {
-  padding: 4px 0px;
-}
-
-
-.p-Menu-itemSubmenuIcon {
-  width: 16px;
-  padding: 4px 0px;
-}
-
-
-.p-Menu-item.p-type-separator > span {
-  padding: 0;
-  height: 9px;
-}
-
-
-.p-Menu-item.p-type-separator > span::after {
-  content: '';
-  display: block;
-  position: relative;
-  top: 4px;
-  border-top: 1px solid #DDDDDD;
-}
-
-
-.p-Menu-itemIcon::before,
-.p-Menu-itemSubmenuIcon::before {
-  font-family: FontAwesome;
-}
-
-
-.p-Menu-item.p-type-check.p-mod-checked > .p-Menu-itemIcon::before {
-  content: '\f00c';
-}
-
-
-.p-Menu-item.p-type-submenu > .p-Menu-itemSubmenuIcon::before {
-  content: '\f0da';
-}

+ 0 - 15
examples/docmanager/index.html

@@ -1,15 +0,0 @@
-<!doctype html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
-    <link rel="stylesheet" type="text/css" href="index.css">
-    <title>Jupyter Document Manager Demo</title>
-  </head>
-  <body>
-    <script id='jupyter-config-data' type="application/json">{ "baseUrl": "{{base_url}}" }</script>
-    <script src="build/bundle.js"></script>
-
-  </body>
-</html>
-   

+ 0 - 84
examples/docmanager/main.py

@@ -1,84 +0,0 @@
-"""
-Copyright (c) Jupyter Development Team.
-Distributed under the terms of the Modified BSD License.
-"""
-import re
-import subprocess
-import sys
-import threading
-import tornado.web
-
-PORT = 8765
-
-
-class MainPageHandler(tornado.web.RequestHandler):
-
-    def initialize(self, base_url):
-        self.base_url = base_url
-
-    def get(self):
-        return self.render("index.html", static=self.static_url,
-                           base_url=self.base_url)
-
-
-def main(argv):
-
-    url = "http://localhost:%s" % PORT
-
-    nb_command = [sys.executable, '-m', 'notebook', '--no-browser', '--debug',
-                  '--NotebookApp.allow_origin="%s"' % url]
-    nb_server = subprocess.Popen(nb_command, stderr=subprocess.STDOUT,
-                                 stdout=subprocess.PIPE)
-
-    # wait for notebook server to start up
-    while 1:
-        line = nb_server.stdout.readline().decode('utf-8').strip()
-        if not line:
-            continue
-        print(line)
-        if 'Jupyter Notebook is running at:' in line:
-            host = re.search('http(.*?)$', line).groups()[0]
-            base_url = 'http' + host
-            break
-
-    while 1:
-        line = nb_server.stdout.readline().decode('utf-8').strip()
-        if not line:
-            continue
-        print(line)
-        if 'Control-C' in line:
-            break
-
-    def print_thread():
-        while 1:
-            line = nb_server.stdout.readline().decode('utf-8').strip()
-            if not line:
-                continue
-            print(line)
-    thread = threading.Thread(target=print_thread)
-    thread.setDaemon(True)
-    thread.start()
-
-    handlers = [
-        (r"/", MainPageHandler, {'base_url': base_url}),
-        (r'/(.*)', tornado.web.StaticFileHandler,
-         {'path': '.'}),
-    ]
-
-    app = tornado.web.Application(handlers, static_path='build',
-                                  template_path='.',
-                                  compiled_template_cache=False)
-
-    app.listen(PORT, 'localhost')
-    loop = tornado.ioloop.IOLoop.instance()
-    print('Browse to http://localhost:%s' % PORT)
-    try:
-        loop.start()
-    except KeyboardInterrupt:
-        print(" Shutting down on SIGINT")
-    finally:
-        nb_server.kill()
-        loop.close()
-
-if __name__ == '__main__':
-    main(sys.argv)

+ 0 - 29
examples/docmanager/package.json

@@ -1,29 +0,0 @@
-{
-  "private": true,
-  "name": "docmanager-example",
-  "dependencies": {
-    "codemirror": "^5.12.0",
-    "jupyter-js-services": "^0.5.1",
-    "jupyter-js-ui": "file:../..",
-    "jupyter-js-utils": "^0.3.1",
-    "phosphor-dockpanel": "^0.9.6",
-    "phosphor-keymap": "^0.7.0"
-  },
-  "scripts": {
-    "build": "tsconfig -u src/tsconfig.json && tsc --project src && webpack --config webpack.conf.js",
-    "clean": "rimraf build && rimraf node_modules",
-    "postinstall": "npm dedupe",
-    "update": "rimraf node_modules/jupyter-js-ui && npm install",
-    "watch:src": "watch 'npm run build' src --wait 5",
-    "watch": "concurrently 'npm run watch:src' 'python main.py'"
-  },
-  "devDependencies": {
-    "concurrently": "^2.0.0",
-    "css-loader": "^0.23.1",
-    "rimraf": "^2.5.2",
-    "style-loader": "^0.13.0",
-    "tsconfig-cli": "^0.1.1",
-    "watch": "^0.17.1",
-    "webpack": "^1.12.14"
-  }
-}

+ 0 - 58
examples/docmanager/src/index.ts

@@ -1,58 +0,0 @@
-// Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
-'use strict';
-
-import {
-  DockPanel
-} from 'phosphor-dockpanel';
-
-import {
-  KeymapManager
-} from 'phosphor-keymap';
-
-import {
-  ContentsManager
-} from 'jupyter-js-services';
-
-import {
-  FileHandler, DocumentManager
-} from 'jupyter-js-ui/lib/docmanager';
-
-import {
-  getBaseUrl
-} from 'jupyter-js-utils';
-
-import 'jupyter-js-ui/lib/index.css';
-import 'jupyter-js-ui/lib/theme.css';
-
-
-function main(): void {
-  let dock = new DockPanel();
-  dock.id = 'main';
-  dock.attach(document.body);
-  window.onresize = () => dock.update();
-  let keymapManager = new KeymapManager();
-  window.addEventListener('keydown', (event) => {
-    keymapManager.processKeydownEvent(event);
-  });
-
-  let contentsManager = new ContentsManager(getBaseUrl());
-  let fileHandler = new FileHandler(contentsManager);
-  let docManager = new DocumentManager();
-  docManager.registerDefault(fileHandler);
-  contentsManager.get('index.html').then(contents => {
-    let widget = docManager.open(contents);
-    dock.insertTabAfter(widget);
-    keymapManager.add([{
-      sequence: ['Accel S'],
-      selector: '.jp-CodeMirrorWidget',
-      handler: () => {
-        fileHandler.save();
-        return true;
-      }
-    }]);
-  });
-
-}
-
-window.onload = main;

+ 0 - 24
examples/docmanager/src/tsconfig.json

@@ -1,24 +0,0 @@
-{
-    "compilerOptions": {
-        "noImplicitAny": true,
-        "noEmitOnError": true,
-        "module": "commonjs",
-        "moduleResolution": "node",
-        "target": "ES5",
-        "outDir": "../build"
-    },
-    "filesGlob": [
-        "../../../src/typings/**/*.d.ts",
-        "index.ts"
-    ],
-    "files": [
-        "../../../src/typings/codemirror/codemirror.d.ts",
-        "../../../src/typings/es6-promise/es6-promise.d.ts",
-        "../../../src/typings/expect.js/expect.js.d.ts",
-        "../../../src/typings/mocha/mocha.d.ts",
-        "../../../src/typings/moment/moment.d.ts",
-        "../../../src/typings/require/require.d.ts",
-        "../../../src/typings/term.js/term.js.d.ts",
-        "index.ts"
-    ]
-}

+ 0 - 25
examples/docmanager/webpack.conf.js

@@ -1,25 +0,0 @@
-
-var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
-
-module.exports = {
-  entry: './build/index.js',
-  output: {
-    path: './build',
-    filename: 'bundle.js'
-  },
-  node: {
-    fs: "empty"
-  },
-  bail: true,
-  module: {
-    loaders: [
-      { test: /\.css$/, loader: 'style-loader!css-loader' },
-    ]
-  },
-  plugins: [
-    new ContextReplacementPlugin(
-      /codemirror\/mode.*$/,
-      /codemirror\/mode.*\.js$/
-    )
-  ]
-}