From d211ebf0679b53eb3b05076dff91521961421cbe Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 29 Sep 2014 17:59:54 -0700 Subject: [PATCH] Basic infrastructure for terminal page --- IPython/html/notebookapp.py | 1 + IPython/html/static/terminal/js/main.js | 12 +++++++++++ IPython/html/templates/page.html | 1 + IPython/html/templates/terminal.html | 27 +++++++++++++++++++++++++ IPython/html/terminal/__init__.py | 0 IPython/html/terminal/handlers.py | 24 ++++++++++++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 IPython/html/static/terminal/js/main.js create mode 100644 IPython/html/templates/terminal.html create mode 100644 IPython/html/terminal/__init__.py create mode 100644 IPython/html/terminal/handlers.py diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index e8e920f34..fb59dc68d 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -190,6 +190,7 @@ class NotebookWebApplication(web.Application): handlers.extend(load_handlers('notebook.handlers')) handlers.extend(load_handlers('nbconvert.handlers')) handlers.extend(load_handlers('kernelspecs.handlers')) + handlers.extend(load_handlers('terminal.handlers')) handlers.extend(load_handlers('services.kernels.handlers')) handlers.extend(load_handlers('services.contents.handlers')) handlers.extend(load_handlers('services.clusters.handlers')) diff --git a/IPython/html/static/terminal/js/main.js b/IPython/html/static/terminal/js/main.js new file mode 100644 index 000000000..bb459686e --- /dev/null +++ b/IPython/html/static/terminal/js/main.js @@ -0,0 +1,12 @@ +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. + +require([ + 'jquery', + 'termjs', + 'custom/custom', +], function( + $, + termjs){ + +}); diff --git a/IPython/html/templates/page.html b/IPython/html/templates/page.html index cc8adb1b2..b3c67b821 100644 --- a/IPython/html/templates/page.html +++ b/IPython/html/templates/page.html @@ -29,6 +29,7 @@ highlight: 'components/highlight.js/build/highlight.pack', moment: "components/moment/moment", codemirror: 'components/codemirror', + termjs: "components/term.js/src/term" }, shim: { underscore: { diff --git a/IPython/html/templates/terminal.html b/IPython/html/templates/terminal.html new file mode 100644 index 000000000..ce75205e5 --- /dev/null +++ b/IPython/html/templates/terminal.html @@ -0,0 +1,27 @@ +{% extends "page.html" %} + +{% block title %}{{page_title}}{% endblock %} + + +{% block params %} + +data-base-url="{{base_url}}" + +{% endblock %} + + +{% block site %} + +
+ +
+ +
+ +{% endblock %} + +{% block script %} + {{super()}} + + +{% endblock %} diff --git a/IPython/html/terminal/__init__.py b/IPython/html/terminal/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/IPython/html/terminal/handlers.py b/IPython/html/terminal/handlers.py new file mode 100644 index 000000000..69f459b98 --- /dev/null +++ b/IPython/html/terminal/handlers.py @@ -0,0 +1,24 @@ +"""Tornado handlers for the terminal emulator.""" + +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. + +from tornado import web +from ..base.handlers import IPythonHandler + + +class TerminalHandler(IPythonHandler): + """Render the tree view, listing notebooks, clusters, etc.""" + @web.authenticated + def get(self, path='', name=None): + self.write(self.render_template('terminal.html')) + + +#----------------------------------------------------------------------------- +# URL to handler mappings +#----------------------------------------------------------------------------- + + +default_handlers = [ + (r"/terminal", TerminalHandler), + ]