##// END OF EJS Templates
Add about dialog in Notebook Help Menu....
Matthias Bussonnier -
Show More
@@ -0,0 +1,38 b''
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
3 require([
4 'jquery',
5 'base/js/dialog',
6 'underscore',
7 'base/js/namespace'
8 ], function ($, dialog, _, IPython) {
9 'use strict';
10 $('#notebook_about').click(function () {
11 // use underscore template to auto html escape
12 var text = 'You are using IPython notebook.<br/><br/>';
13 text = text + 'The version of the notebook server is ';
14 text = text + _.template('<b><%- version %></b>')({ version: sys_info.ipython_version });
15 if (sys_info.commit_hash) {
16 text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
17 }
18 text = text + _.template(' and is running on:<br/><pre>Python <%- pyver %></pre>')({ pyver: sys_info.sys_version });
19 var kinfo = $('<div/>').attr('id', '#about-kinfo').text('Waiting for kernel to be available...');
20 var body = $('<div/>');
21 body.append($('<h4/>').text('Server Information:'));
22 body.append($('<p/>').html(text));
23 body.append($('<h4/>').text('Current Kernel Information:'));
24 body.append(kinfo);
25 dialog.modal({
26 title: 'About IPython Notebook',
27 body: body,
28 buttons: { 'OK': {} }
29 });
30 try {
31 IPython.notebook.session.kernel.kernel_info(function (data) {
32 kinfo.html($('<pre/>').text(data.content.banner));
33 });
34 } catch (e) {
35 kinfo.html($('<p/>').text('unable to contact kernel'));
36 }
37 });
38 });
@@ -25,6 +25,7 b' except ImportError:'
25 app_log = logging.getLogger()
25 app_log = logging.getLogger()
26
26
27 import IPython
27 import IPython
28 from IPython.utils.sysinfo import get_sys_info
28
29
29 from IPython.config import Application
30 from IPython.config import Application
30 from IPython.utils.path import filefind
31 from IPython.utils.path import filefind
@@ -221,6 +222,7 b' class IPythonHandler(AuthenticatedHandler):'
221 logged_in=self.logged_in,
222 logged_in=self.logged_in,
222 login_available=self.login_available,
223 login_available=self.login_available,
223 static_url=self.static_url,
224 static_url=self.static_url,
225 sys_info=json.dumps(get_sys_info())
224 )
226 )
225
227
226 def get_json_body(self):
228 def get_json_body(self):
@@ -20,6 +20,7 b' require(['
20 'notebook/js/config',
20 'notebook/js/config',
21 'notebook/js/kernelselector',
21 'notebook/js/kernelselector',
22 'codemirror/lib/codemirror',
22 'codemirror/lib/codemirror',
23 'notebook/js/about',
23 // only loaded, not used, please keep sure this is loaded last
24 // only loaded, not used, please keep sure this is loaded last
24 'custom/custom'
25 'custom/custom'
25 ], function(
26 ], function(
@@ -41,6 +42,7 b' require(['
41 config,
42 config,
42 kernelselector,
43 kernelselector,
43 CodeMirror,
44 CodeMirror,
45 about,
44 // please keep sure that even if not used, this is loaded last
46 // please keep sure that even if not used, this is loaded last
45 custom
47 custom
46 ) {
48 ) {
@@ -266,7 +266,8 b' class="notebook_app"'
266 <li class="divider"></li>
266 <li class="divider"></li>
267 {% endif %}
267 {% endif %}
268 {% endfor %}
268 {% endfor %}
269 </li>
269 <li class="divider"></li>
270 <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li>
270 </ul>
271 </ul>
271 </li>
272 </li>
272 </ul>
273 </ul>
@@ -310,6 +311,9 b' class="notebook_app"'
310
311
311 {% block script %}
312 {% block script %}
312 {{super()}}
313 {{super()}}
314 <script type="text/javascript">
315 sys_info = {{sys_info}};
316 </script>
313
317
314
318
315 <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script>
319 <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script>
General Comments 0
You need to be logged in to leave comments. Login now