diff --git a/IPython/html/base/handlers.py b/IPython/html/base/handlers.py index 768eaff..d7aefa6 100644 --- a/IPython/html/base/handlers.py +++ b/IPython/html/base/handlers.py @@ -25,6 +25,7 @@ except ImportError: app_log = logging.getLogger() import IPython +from IPython.utils.sysinfo import get_sys_info from IPython.config import Application from IPython.utils.path import filefind @@ -221,6 +222,7 @@ class IPythonHandler(AuthenticatedHandler): logged_in=self.logged_in, login_available=self.login_available, static_url=self.static_url, + sys_info=json.dumps(get_sys_info()) ) def get_json_body(self): diff --git a/IPython/html/static/notebook/js/about.js b/IPython/html/static/notebook/js/about.js new file mode 100644 index 0000000..b8f106e --- /dev/null +++ b/IPython/html/static/notebook/js/about.js @@ -0,0 +1,38 @@ +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. +require([ + 'jquery', + 'base/js/dialog', + 'underscore', + 'base/js/namespace' +], function ($, dialog, _, IPython) { + 'use strict'; + $('#notebook_about').click(function () { + // use underscore template to auto html escape + var text = 'You are using IPython notebook.

'; + text = text + 'The version of the notebook server is '; + text = text + _.template('<%- version %>')({ version: sys_info.ipython_version }); + if (sys_info.commit_hash) { + text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash }); + } + text = text + _.template(' and is running on:
Python <%- pyver %>
')({ pyver: sys_info.sys_version }); + var kinfo = $('
').attr('id', '#about-kinfo').text('Waiting for kernel to be available...'); + var body = $('
'); + body.append($('

').text('Server Information:')); + body.append($('

').html(text)); + body.append($('

').text('Current Kernel Information:')); + body.append(kinfo); + dialog.modal({ + title: 'About IPython Notebook', + body: body, + buttons: { 'OK': {} } + }); + try { + IPython.notebook.session.kernel.kernel_info(function (data) { + kinfo.html($('
').text(data.content.banner));
+            });
+        } catch (e) {
+            kinfo.html($('

').text('unable to contact kernel')); + } + }); +}); diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index 5c41f4b..3cf2782 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -20,6 +20,7 @@ require([ 'notebook/js/config', 'notebook/js/kernelselector', 'codemirror/lib/codemirror', + 'notebook/js/about', // only loaded, not used, please keep sure this is loaded last 'custom/custom' ], function( @@ -41,6 +42,7 @@ require([ config, kernelselector, CodeMirror, + about, // please keep sure that even if not used, this is loaded last custom ) { diff --git a/IPython/html/templates/notebook.html b/IPython/html/templates/notebook.html index 86949ef..10e828b 100644 --- a/IPython/html/templates/notebook.html +++ b/IPython/html/templates/notebook.html @@ -245,7 +245,7 @@ class="notebook_app" ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True), ),( ("http://docs.python.org","Python",True), - ("http://help.github.com/articles/github-flavored-markdown","Markdown",True), + ("http://help.github.com/articles/github-flavored-markdown","Markdown",True), ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True), ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True), ("http://matplotlib.org/contents.html","Matplotlib",True), @@ -266,7 +266,8 @@ class="notebook_app"

  • {% endif %} {% endfor %} - +
  • +
  • About
  • @@ -310,6 +311,9 @@ class="notebook_app" {% block script %} {{super()}} +