##// END OF EJS Templates
support pdf export in the notebook UI
MinRK -
Show More
@@ -1,140 +1,140 b''
1 import io
1 import io
2 import os
2 import os
3 import zipfile
3 import zipfile
4
4
5 from tornado import web
5 from tornado import web
6
6
7 from ..base.handlers import IPythonHandler, notebook_path_regex
7 from ..base.handlers import IPythonHandler, notebook_path_regex
8 from IPython.nbformat.current import to_notebook_json
8 from IPython.nbformat.current import to_notebook_json
9
9
10 from IPython.utils import tz
10 from IPython.utils import tz
11 from IPython.utils.py3compat import cast_bytes
11 from IPython.utils.py3compat import cast_bytes
12
12
13 import sys
13 import sys
14
14
15 def find_resource_files(output_files_dir):
15 def find_resource_files(output_files_dir):
16 files = []
16 files = []
17 for dirpath, dirnames, filenames in os.walk(output_files_dir):
17 for dirpath, dirnames, filenames in os.walk(output_files_dir):
18 files.extend([os.path.join(dirpath, f) for f in filenames])
18 files.extend([os.path.join(dirpath, f) for f in filenames])
19 return files
19 return files
20
20
21 def respond_zip(handler, name, output, resources):
21 def respond_zip(handler, name, output, resources):
22 """Zip up the output and resource files and respond with the zip file.
22 """Zip up the output and resource files and respond with the zip file.
23
23
24 Returns True if it has served a zip file, False if there are no resource
24 Returns True if it has served a zip file, False if there are no resource
25 files, in which case we serve the plain output file.
25 files, in which case we serve the plain output file.
26 """
26 """
27 # Check if we have resource files we need to zip
27 # Check if we have resource files we need to zip
28 output_files = resources.get('outputs', None)
28 output_files = resources.get('outputs', None)
29 if not output_files:
29 if not output_files:
30 return False
30 return False
31
31
32 # Headers
32 # Headers
33 zip_filename = os.path.splitext(name)[0] + '.zip'
33 zip_filename = os.path.splitext(name)[0] + '.zip'
34 handler.set_header('Content-Disposition',
34 handler.set_header('Content-Disposition',
35 'attachment; filename="%s"' % zip_filename)
35 'attachment; filename="%s"' % zip_filename)
36 handler.set_header('Content-Type', 'application/zip')
36 handler.set_header('Content-Type', 'application/zip')
37
37
38 # Prepare the zip file
38 # Prepare the zip file
39 buffer = io.BytesIO()
39 buffer = io.BytesIO()
40 zipf = zipfile.ZipFile(buffer, mode='w', compression=zipfile.ZIP_DEFLATED)
40 zipf = zipfile.ZipFile(buffer, mode='w', compression=zipfile.ZIP_DEFLATED)
41 output_filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
41 output_filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
42 zipf.writestr(output_filename, cast_bytes(output, 'utf-8'))
42 zipf.writestr(output_filename, cast_bytes(output, 'utf-8'))
43 for filename, data in output_files.items():
43 for filename, data in output_files.items():
44 zipf.writestr(os.path.basename(filename), data)
44 zipf.writestr(os.path.basename(filename), data)
45 zipf.close()
45 zipf.close()
46
46
47 handler.finish(buffer.getvalue())
47 handler.finish(buffer.getvalue())
48 return True
48 return True
49
49
50 def get_exporter(format, **kwargs):
50 def get_exporter(format, **kwargs):
51 """get an exporter, raising appropriate errors"""
51 """get an exporter, raising appropriate errors"""
52 # if this fails, will raise 500
52 # if this fails, will raise 500
53 try:
53 try:
54 from IPython.nbconvert.exporters.export import exporter_map
54 from IPython.nbconvert.exporters.export import exporter_map
55 except ImportError as e:
55 except ImportError as e:
56 raise web.HTTPError(500, "Could not import nbconvert: %s" % e)
56 raise web.HTTPError(500, "Could not import nbconvert: %s" % e)
57
57
58 try:
58 try:
59 Exporter = exporter_map[format]
59 Exporter = exporter_map[format]
60 except KeyError:
60 except KeyError:
61 # should this be 400?
61 # should this be 400?
62 raise web.HTTPError(404, u"No exporter for format: %s" % format)
62 raise web.HTTPError(404, u"No exporter for format: %s" % format)
63
63
64 try:
64 try:
65 return Exporter(**kwargs)
65 return Exporter(**kwargs)
66 except Exception as e:
66 except Exception as e:
67 raise web.HTTPError(500, "Could not construct Exporter: %s" % e)
67 raise web.HTTPError(500, "Could not construct Exporter: %s" % e)
68
68
69 class NbconvertFileHandler(IPythonHandler):
69 class NbconvertFileHandler(IPythonHandler):
70
70
71 SUPPORTED_METHODS = ('GET',)
71 SUPPORTED_METHODS = ('GET',)
72
72
73 @web.authenticated
73 @web.authenticated
74 def get(self, format, path='', name=None):
74 def get(self, format, path='', name=None):
75
75
76 exporter = get_exporter(format, config=self.config)
76 exporter = get_exporter(format, config=self.config, log=self.log)
77
77
78 path = path.strip('/')
78 path = path.strip('/')
79 model = self.notebook_manager.get_notebook(name=name, path=path)
79 model = self.notebook_manager.get_notebook(name=name, path=path)
80
80
81 self.set_header('Last-Modified', model['last_modified'])
81 self.set_header('Last-Modified', model['last_modified'])
82
82
83 try:
83 try:
84 output, resources = exporter.from_notebook_node(model['content'])
84 output, resources = exporter.from_notebook_node(model['content'])
85 except Exception as e:
85 except Exception as e:
86 raise web.HTTPError(500, "nbconvert failed: %s" % e)
86 raise web.HTTPError(500, "nbconvert failed: %s" % e)
87
87
88 if respond_zip(self, name, output, resources):
88 if respond_zip(self, name, output, resources):
89 return
89 return
90
90
91 # Force download if requested
91 # Force download if requested
92 if self.get_argument('download', 'false').lower() == 'true':
92 if self.get_argument('download', 'false').lower() == 'true':
93 filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
93 filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
94 self.set_header('Content-Disposition',
94 self.set_header('Content-Disposition',
95 'attachment; filename="%s"' % filename)
95 'attachment; filename="%s"' % filename)
96
96
97 # MIME type
97 # MIME type
98 if exporter.output_mimetype:
98 if exporter.output_mimetype:
99 self.set_header('Content-Type',
99 self.set_header('Content-Type',
100 '%s; charset=utf-8' % exporter.output_mimetype)
100 '%s; charset=utf-8' % exporter.output_mimetype)
101
101
102 self.finish(output)
102 self.finish(output)
103
103
104 class NbconvertPostHandler(IPythonHandler):
104 class NbconvertPostHandler(IPythonHandler):
105 SUPPORTED_METHODS = ('POST',)
105 SUPPORTED_METHODS = ('POST',)
106
106
107 @web.authenticated
107 @web.authenticated
108 def post(self, format):
108 def post(self, format):
109 exporter = get_exporter(format, config=self.config)
109 exporter = get_exporter(format, config=self.config)
110
110
111 model = self.get_json_body()
111 model = self.get_json_body()
112 nbnode = to_notebook_json(model['content'])
112 nbnode = to_notebook_json(model['content'])
113
113
114 try:
114 try:
115 output, resources = exporter.from_notebook_node(nbnode)
115 output, resources = exporter.from_notebook_node(nbnode)
116 except Exception as e:
116 except Exception as e:
117 raise web.HTTPError(500, "nbconvert failed: %s" % e)
117 raise web.HTTPError(500, "nbconvert failed: %s" % e)
118
118
119 if respond_zip(self, nbnode.metadata.name, output, resources):
119 if respond_zip(self, nbnode.metadata.name, output, resources):
120 return
120 return
121
121
122 # MIME type
122 # MIME type
123 if exporter.output_mimetype:
123 if exporter.output_mimetype:
124 self.set_header('Content-Type',
124 self.set_header('Content-Type',
125 '%s; charset=utf-8' % exporter.output_mimetype)
125 '%s; charset=utf-8' % exporter.output_mimetype)
126
126
127 self.finish(output)
127 self.finish(output)
128
128
129 #-----------------------------------------------------------------------------
129 #-----------------------------------------------------------------------------
130 # URL to handler mappings
130 # URL to handler mappings
131 #-----------------------------------------------------------------------------
131 #-----------------------------------------------------------------------------
132
132
133 _format_regex = r"(?P<format>\w+)"
133 _format_regex = r"(?P<format>\w+)"
134
134
135
135
136 default_handlers = [
136 default_handlers = [
137 (r"/nbconvert/%s%s" % (_format_regex, notebook_path_regex),
137 (r"/nbconvert/%s%s" % (_format_regex, notebook_path_regex),
138 NbconvertFileHandler),
138 NbconvertFileHandler),
139 (r"/nbconvert/%s" % _format_regex, NbconvertPostHandler),
139 (r"/nbconvert/%s" % _format_regex, NbconvertPostHandler),
140 ] No newline at end of file
140 ]
@@ -1,335 +1,335 b''
1 //----------------------------------------------------------------------------
1 // Copyright (c) IPython Development Team.
2 // Copyright (C) 2008-2011 The IPython Development Team
2 // Distributed under the terms of the Modified BSD License.
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
7
3
8 //============================================================================
4 //============================================================================
9 // MenuBar
5 // MenuBar
10 //============================================================================
6 //============================================================================
11
7
12 /**
8 /**
13 * @module IPython
9 * @module IPython
14 * @namespace IPython
10 * @namespace IPython
15 * @submodule MenuBar
11 * @submodule MenuBar
16 */
12 */
17
13
18
14
19 var IPython = (function (IPython) {
15 var IPython = (function (IPython) {
20 "use strict";
16 "use strict";
21
17
22 var utils = IPython.utils;
18 var utils = IPython.utils;
23
19
24 /**
20 /**
25 * A MenuBar Class to generate the menubar of IPython notebook
21 * A MenuBar Class to generate the menubar of IPython notebook
26 * @Class MenuBar
22 * @Class MenuBar
27 *
23 *
28 * @constructor
24 * @constructor
29 *
25 *
30 *
26 *
31 * @param selector {string} selector for the menubar element in DOM
27 * @param selector {string} selector for the menubar element in DOM
32 * @param {object} [options]
28 * @param {object} [options]
33 * @param [options.base_url] {String} String to use for the
29 * @param [options.base_url] {String} String to use for the
34 * base project url. Default is to inspect
30 * base project url. Default is to inspect
35 * $('body').data('baseUrl');
31 * $('body').data('baseUrl');
36 * does not support change for now is set through this option
32 * does not support change for now is set through this option
37 */
33 */
38 var MenuBar = function (selector, options) {
34 var MenuBar = function (selector, options) {
39 options = options || {};
35 options = options || {};
40 this.base_url = options.base_url || IPython.utils.get_body_data("baseUrl");
36 this.base_url = options.base_url || IPython.utils.get_body_data("baseUrl");
41 this.selector = selector;
37 this.selector = selector;
42 if (this.selector !== undefined) {
38 if (this.selector !== undefined) {
43 this.element = $(selector);
39 this.element = $(selector);
44 this.style();
40 this.style();
45 this.bind_events();
41 this.bind_events();
46 }
42 }
47 };
43 };
48
44
49 MenuBar.prototype.style = function () {
45 MenuBar.prototype.style = function () {
50 this.element.addClass('border-box-sizing');
46 this.element.addClass('border-box-sizing');
51 this.element.find("li").click(function (event, ui) {
47 this.element.find("li").click(function (event, ui) {
52 // The selected cell loses focus when the menu is entered, so we
48 // The selected cell loses focus when the menu is entered, so we
53 // re-select it upon selection.
49 // re-select it upon selection.
54 var i = IPython.notebook.get_selected_index();
50 var i = IPython.notebook.get_selected_index();
55 IPython.notebook.select(i);
51 IPython.notebook.select(i);
56 }
52 }
57 );
53 );
58 };
54 };
59
55
60 MenuBar.prototype._nbconvert = function (format, download) {
56 MenuBar.prototype._nbconvert = function (format, download) {
61 download = download || false;
57 download = download || false;
62 var notebook_path = IPython.notebook.notebook_path;
58 var notebook_path = IPython.notebook.notebook_path;
63 var notebook_name = IPython.notebook.notebook_name;
59 var notebook_name = IPython.notebook.notebook_name;
64 if (IPython.notebook.dirty) {
60 if (IPython.notebook.dirty) {
65 IPython.notebook.save_notebook({async : false});
61 IPython.notebook.save_notebook({async : false});
66 }
62 }
67 var url = utils.url_join_encode(
63 var url = utils.url_join_encode(
68 this.base_url,
64 this.base_url,
69 'nbconvert',
65 'nbconvert',
70 format,
66 format,
71 notebook_path,
67 notebook_path,
72 notebook_name
68 notebook_name
73 ) + "?download=" + download.toString();
69 ) + "?download=" + download.toString();
74
70
75 window.open(url);
71 window.open(url);
76 };
72 };
77
73
78 MenuBar.prototype.bind_events = function () {
74 MenuBar.prototype.bind_events = function () {
79 // File
75 // File
80 var that = this;
76 var that = this;
81 this.element.find('#new_notebook').click(function () {
77 this.element.find('#new_notebook').click(function () {
82 IPython.notebook.new_notebook();
78 IPython.notebook.new_notebook();
83 });
79 });
84 this.element.find('#open_notebook').click(function () {
80 this.element.find('#open_notebook').click(function () {
85 window.open(utils.url_join_encode(
81 window.open(utils.url_join_encode(
86 IPython.notebook.base_url,
82 IPython.notebook.base_url,
87 'tree',
83 'tree',
88 IPython.notebook.notebook_path
84 IPython.notebook.notebook_path
89 ));
85 ));
90 });
86 });
91 this.element.find('#copy_notebook').click(function () {
87 this.element.find('#copy_notebook').click(function () {
92 IPython.notebook.copy_notebook();
88 IPython.notebook.copy_notebook();
93 return false;
89 return false;
94 });
90 });
95 this.element.find('#download_ipynb').click(function () {
91 this.element.find('#download_ipynb').click(function () {
96 var base_url = IPython.notebook.base_url;
92 var base_url = IPython.notebook.base_url;
97 var notebook_path = IPython.notebook.notebook_path;
93 var notebook_path = IPython.notebook.notebook_path;
98 var notebook_name = IPython.notebook.notebook_name;
94 var notebook_name = IPython.notebook.notebook_name;
99 if (IPython.notebook.dirty) {
95 if (IPython.notebook.dirty) {
100 IPython.notebook.save_notebook({async : false});
96 IPython.notebook.save_notebook({async : false});
101 }
97 }
102
98
103 var url = utils.url_join_encode(
99 var url = utils.url_join_encode(
104 base_url,
100 base_url,
105 'files',
101 'files',
106 notebook_path,
102 notebook_path,
107 notebook_name
103 notebook_name
108 );
104 );
109 window.location.assign(url);
105 window.location.assign(url);
110 });
106 });
111
107
112 this.element.find('#print_preview').click(function () {
108 this.element.find('#print_preview').click(function () {
113 that._nbconvert('html', false);
109 that._nbconvert('html', false);
114 });
110 });
115
111
116 this.element.find('#download_py').click(function () {
112 this.element.find('#download_py').click(function () {
117 that._nbconvert('python', true);
113 that._nbconvert('python', true);
118 });
114 });
119
115
120 this.element.find('#download_html').click(function () {
116 this.element.find('#download_html').click(function () {
121 that._nbconvert('html', true);
117 that._nbconvert('html', true);
122 });
118 });
123
119
124 this.element.find('#download_rst').click(function () {
120 this.element.find('#download_rst').click(function () {
125 that._nbconvert('rst', true);
121 that._nbconvert('rst', true);
126 });
122 });
127
123
124 this.element.find('#download_pdf').click(function () {
125 that._nbconvert('pdf', true);
126 });
127
128 this.element.find('#rename_notebook').click(function () {
128 this.element.find('#rename_notebook').click(function () {
129 IPython.save_widget.rename_notebook();
129 IPython.save_widget.rename_notebook();
130 });
130 });
131 this.element.find('#save_checkpoint').click(function () {
131 this.element.find('#save_checkpoint').click(function () {
132 IPython.notebook.save_checkpoint();
132 IPython.notebook.save_checkpoint();
133 });
133 });
134 this.element.find('#restore_checkpoint').click(function () {
134 this.element.find('#restore_checkpoint').click(function () {
135 });
135 });
136 this.element.find('#trust_notebook').click(function () {
136 this.element.find('#trust_notebook').click(function () {
137 IPython.notebook.trust_notebook();
137 IPython.notebook.trust_notebook();
138 });
138 });
139 $([IPython.events]).on('trust_changed.Notebook', function (event, trusted) {
139 $([IPython.events]).on('trust_changed.Notebook', function (event, trusted) {
140 if (trusted) {
140 if (trusted) {
141 that.element.find('#trust_notebook')
141 that.element.find('#trust_notebook')
142 .addClass("disabled")
142 .addClass("disabled")
143 .find("a").text("Trusted Notebook");
143 .find("a").text("Trusted Notebook");
144 } else {
144 } else {
145 that.element.find('#trust_notebook')
145 that.element.find('#trust_notebook')
146 .removeClass("disabled")
146 .removeClass("disabled")
147 .find("a").text("Trust Notebook");
147 .find("a").text("Trust Notebook");
148 }
148 }
149 });
149 });
150 this.element.find('#kill_and_exit').click(function () {
150 this.element.find('#kill_and_exit').click(function () {
151 IPython.notebook.session.delete();
151 IPython.notebook.session.delete();
152 setTimeout(function(){
152 setTimeout(function(){
153 // allow closing of new tabs in Chromium, impossible in FF
153 // allow closing of new tabs in Chromium, impossible in FF
154 window.open('', '_self', '');
154 window.open('', '_self', '');
155 window.close();
155 window.close();
156 }, 500);
156 }, 500);
157 });
157 });
158 // Edit
158 // Edit
159 this.element.find('#cut_cell').click(function () {
159 this.element.find('#cut_cell').click(function () {
160 IPython.notebook.cut_cell();
160 IPython.notebook.cut_cell();
161 });
161 });
162 this.element.find('#copy_cell').click(function () {
162 this.element.find('#copy_cell').click(function () {
163 IPython.notebook.copy_cell();
163 IPython.notebook.copy_cell();
164 });
164 });
165 this.element.find('#delete_cell').click(function () {
165 this.element.find('#delete_cell').click(function () {
166 IPython.notebook.delete_cell();
166 IPython.notebook.delete_cell();
167 });
167 });
168 this.element.find('#undelete_cell').click(function () {
168 this.element.find('#undelete_cell').click(function () {
169 IPython.notebook.undelete_cell();
169 IPython.notebook.undelete_cell();
170 });
170 });
171 this.element.find('#split_cell').click(function () {
171 this.element.find('#split_cell').click(function () {
172 IPython.notebook.split_cell();
172 IPython.notebook.split_cell();
173 });
173 });
174 this.element.find('#merge_cell_above').click(function () {
174 this.element.find('#merge_cell_above').click(function () {
175 IPython.notebook.merge_cell_above();
175 IPython.notebook.merge_cell_above();
176 });
176 });
177 this.element.find('#merge_cell_below').click(function () {
177 this.element.find('#merge_cell_below').click(function () {
178 IPython.notebook.merge_cell_below();
178 IPython.notebook.merge_cell_below();
179 });
179 });
180 this.element.find('#move_cell_up').click(function () {
180 this.element.find('#move_cell_up').click(function () {
181 IPython.notebook.move_cell_up();
181 IPython.notebook.move_cell_up();
182 });
182 });
183 this.element.find('#move_cell_down').click(function () {
183 this.element.find('#move_cell_down').click(function () {
184 IPython.notebook.move_cell_down();
184 IPython.notebook.move_cell_down();
185 });
185 });
186 this.element.find('#edit_nb_metadata').click(function () {
186 this.element.find('#edit_nb_metadata').click(function () {
187 IPython.notebook.edit_metadata();
187 IPython.notebook.edit_metadata();
188 });
188 });
189
189
190 // View
190 // View
191 this.element.find('#toggle_header').click(function () {
191 this.element.find('#toggle_header').click(function () {
192 $('div#header').toggle();
192 $('div#header').toggle();
193 IPython.layout_manager.do_resize();
193 IPython.layout_manager.do_resize();
194 });
194 });
195 this.element.find('#toggle_toolbar').click(function () {
195 this.element.find('#toggle_toolbar').click(function () {
196 $('div#maintoolbar').toggle();
196 $('div#maintoolbar').toggle();
197 IPython.layout_manager.do_resize();
197 IPython.layout_manager.do_resize();
198 });
198 });
199 // Insert
199 // Insert
200 this.element.find('#insert_cell_above').click(function () {
200 this.element.find('#insert_cell_above').click(function () {
201 IPython.notebook.insert_cell_above('code');
201 IPython.notebook.insert_cell_above('code');
202 IPython.notebook.select_prev();
202 IPython.notebook.select_prev();
203 });
203 });
204 this.element.find('#insert_cell_below').click(function () {
204 this.element.find('#insert_cell_below').click(function () {
205 IPython.notebook.insert_cell_below('code');
205 IPython.notebook.insert_cell_below('code');
206 IPython.notebook.select_next();
206 IPython.notebook.select_next();
207 });
207 });
208 // Cell
208 // Cell
209 this.element.find('#run_cell').click(function () {
209 this.element.find('#run_cell').click(function () {
210 IPython.notebook.execute_cell();
210 IPython.notebook.execute_cell();
211 });
211 });
212 this.element.find('#run_cell_select_below').click(function () {
212 this.element.find('#run_cell_select_below').click(function () {
213 IPython.notebook.execute_cell_and_select_below();
213 IPython.notebook.execute_cell_and_select_below();
214 });
214 });
215 this.element.find('#run_cell_insert_below').click(function () {
215 this.element.find('#run_cell_insert_below').click(function () {
216 IPython.notebook.execute_cell_and_insert_below();
216 IPython.notebook.execute_cell_and_insert_below();
217 });
217 });
218 this.element.find('#run_all_cells').click(function () {
218 this.element.find('#run_all_cells').click(function () {
219 IPython.notebook.execute_all_cells();
219 IPython.notebook.execute_all_cells();
220 });
220 });
221 this.element.find('#run_all_cells_above').click(function () {
221 this.element.find('#run_all_cells_above').click(function () {
222 IPython.notebook.execute_cells_above();
222 IPython.notebook.execute_cells_above();
223 });
223 });
224 this.element.find('#run_all_cells_below').click(function () {
224 this.element.find('#run_all_cells_below').click(function () {
225 IPython.notebook.execute_cells_below();
225 IPython.notebook.execute_cells_below();
226 });
226 });
227 this.element.find('#to_code').click(function () {
227 this.element.find('#to_code').click(function () {
228 IPython.notebook.to_code();
228 IPython.notebook.to_code();
229 });
229 });
230 this.element.find('#to_markdown').click(function () {
230 this.element.find('#to_markdown').click(function () {
231 IPython.notebook.to_markdown();
231 IPython.notebook.to_markdown();
232 });
232 });
233 this.element.find('#to_raw').click(function () {
233 this.element.find('#to_raw').click(function () {
234 IPython.notebook.to_raw();
234 IPython.notebook.to_raw();
235 });
235 });
236 this.element.find('#to_heading1').click(function () {
236 this.element.find('#to_heading1').click(function () {
237 IPython.notebook.to_heading(undefined, 1);
237 IPython.notebook.to_heading(undefined, 1);
238 });
238 });
239 this.element.find('#to_heading2').click(function () {
239 this.element.find('#to_heading2').click(function () {
240 IPython.notebook.to_heading(undefined, 2);
240 IPython.notebook.to_heading(undefined, 2);
241 });
241 });
242 this.element.find('#to_heading3').click(function () {
242 this.element.find('#to_heading3').click(function () {
243 IPython.notebook.to_heading(undefined, 3);
243 IPython.notebook.to_heading(undefined, 3);
244 });
244 });
245 this.element.find('#to_heading4').click(function () {
245 this.element.find('#to_heading4').click(function () {
246 IPython.notebook.to_heading(undefined, 4);
246 IPython.notebook.to_heading(undefined, 4);
247 });
247 });
248 this.element.find('#to_heading5').click(function () {
248 this.element.find('#to_heading5').click(function () {
249 IPython.notebook.to_heading(undefined, 5);
249 IPython.notebook.to_heading(undefined, 5);
250 });
250 });
251 this.element.find('#to_heading6').click(function () {
251 this.element.find('#to_heading6').click(function () {
252 IPython.notebook.to_heading(undefined, 6);
252 IPython.notebook.to_heading(undefined, 6);
253 });
253 });
254
254
255 this.element.find('#toggle_current_output').click(function () {
255 this.element.find('#toggle_current_output').click(function () {
256 IPython.notebook.toggle_output();
256 IPython.notebook.toggle_output();
257 });
257 });
258 this.element.find('#toggle_current_output_scroll').click(function () {
258 this.element.find('#toggle_current_output_scroll').click(function () {
259 IPython.notebook.toggle_output_scroll();
259 IPython.notebook.toggle_output_scroll();
260 });
260 });
261 this.element.find('#clear_current_output').click(function () {
261 this.element.find('#clear_current_output').click(function () {
262 IPython.notebook.clear_output();
262 IPython.notebook.clear_output();
263 });
263 });
264
264
265 this.element.find('#toggle_all_output').click(function () {
265 this.element.find('#toggle_all_output').click(function () {
266 IPython.notebook.toggle_all_output();
266 IPython.notebook.toggle_all_output();
267 });
267 });
268 this.element.find('#toggle_all_output_scroll').click(function () {
268 this.element.find('#toggle_all_output_scroll').click(function () {
269 IPython.notebook.toggle_all_output_scroll();
269 IPython.notebook.toggle_all_output_scroll();
270 });
270 });
271 this.element.find('#clear_all_output').click(function () {
271 this.element.find('#clear_all_output').click(function () {
272 IPython.notebook.clear_all_output();
272 IPython.notebook.clear_all_output();
273 });
273 });
274
274
275 // Kernel
275 // Kernel
276 this.element.find('#int_kernel').click(function () {
276 this.element.find('#int_kernel').click(function () {
277 IPython.notebook.session.interrupt_kernel();
277 IPython.notebook.session.interrupt_kernel();
278 });
278 });
279 this.element.find('#restart_kernel').click(function () {
279 this.element.find('#restart_kernel').click(function () {
280 IPython.notebook.restart_kernel();
280 IPython.notebook.restart_kernel();
281 });
281 });
282 // Help
282 // Help
283 this.element.find('#notebook_tour').click(function () {
283 this.element.find('#notebook_tour').click(function () {
284 IPython.tour.start();
284 IPython.tour.start();
285 });
285 });
286 this.element.find('#keyboard_shortcuts').click(function () {
286 this.element.find('#keyboard_shortcuts').click(function () {
287 IPython.quick_help.show_keyboard_shortcuts();
287 IPython.quick_help.show_keyboard_shortcuts();
288 });
288 });
289
289
290 this.update_restore_checkpoint(null);
290 this.update_restore_checkpoint(null);
291
291
292 $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
292 $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
293 that.update_restore_checkpoint(IPython.notebook.checkpoints);
293 that.update_restore_checkpoint(IPython.notebook.checkpoints);
294 });
294 });
295
295
296 $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
296 $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
297 that.update_restore_checkpoint(IPython.notebook.checkpoints);
297 that.update_restore_checkpoint(IPython.notebook.checkpoints);
298 });
298 });
299 };
299 };
300
300
301 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
301 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
302 var ul = this.element.find("#restore_checkpoint").find("ul");
302 var ul = this.element.find("#restore_checkpoint").find("ul");
303 ul.empty();
303 ul.empty();
304 if (!checkpoints || checkpoints.length === 0) {
304 if (!checkpoints || checkpoints.length === 0) {
305 ul.append(
305 ul.append(
306 $("<li/>")
306 $("<li/>")
307 .addClass("disabled")
307 .addClass("disabled")
308 .append(
308 .append(
309 $("<a/>")
309 $("<a/>")
310 .text("No checkpoints")
310 .text("No checkpoints")
311 )
311 )
312 );
312 );
313 return;
313 return;
314 }
314 }
315
315
316 checkpoints.map(function (checkpoint) {
316 checkpoints.map(function (checkpoint) {
317 var d = new Date(checkpoint.last_modified);
317 var d = new Date(checkpoint.last_modified);
318 ul.append(
318 ul.append(
319 $("<li/>").append(
319 $("<li/>").append(
320 $("<a/>")
320 $("<a/>")
321 .attr("href", "#")
321 .attr("href", "#")
322 .text(d.format("mmm dd HH:MM:ss"))
322 .text(d.format("mmm dd HH:MM:ss"))
323 .click(function () {
323 .click(function () {
324 IPython.notebook.restore_checkpoint_dialog(checkpoint);
324 IPython.notebook.restore_checkpoint_dialog(checkpoint);
325 })
325 })
326 )
326 )
327 );
327 );
328 });
328 });
329 };
329 };
330
330
331 IPython.MenuBar = MenuBar;
331 IPython.MenuBar = MenuBar;
332
332
333 return IPython;
333 return IPython;
334
334
335 }(IPython));
335 }(IPython));
@@ -1,360 +1,361 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 {% endif %}
7 {% endif %}
8 <script type="text/javascript">
8 <script type="text/javascript">
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 // where it will be undefined, and should prompt a dialog later.
10 // where it will be undefined, and should prompt a dialog later.
11 window.mathjax_url = "{{mathjax_url}}";
11 window.mathjax_url = "{{mathjax_url}}";
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
16
16
17 {{super()}}
17 {{super()}}
18
18
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
20
20
21 {% endblock %}
21 {% endblock %}
22
22
23 {% block params %}
23 {% block params %}
24
24
25 data-project="{{project}}"
25 data-project="{{project}}"
26 data-base-url="{{base_url}}"
26 data-base-url="{{base_url}}"
27 data-notebook-name="{{notebook_name}}"
27 data-notebook-name="{{notebook_name}}"
28 data-notebook-path="{{notebook_path}}"
28 data-notebook-path="{{notebook_path}}"
29 class="notebook_app"
29 class="notebook_app"
30
30
31 {% endblock %}
31 {% endblock %}
32
32
33
33
34 {% block header %}
34 {% block header %}
35
35
36 <span id="save_widget" class="nav pull-left">
36 <span id="save_widget" class="nav pull-left">
37 <span id="notebook_name"></span>
37 <span id="notebook_name"></span>
38 <span id="checkpoint_status"></span>
38 <span id="checkpoint_status"></span>
39 <span id="autosave_status"></span>
39 <span id="autosave_status"></span>
40 </span>
40 </span>
41
41
42 {% endblock %}
42 {% endblock %}
43
43
44
44
45 {% block site %}
45 {% block site %}
46
46
47 <div id="menubar-container" class="container">
47 <div id="menubar-container" class="container">
48 <div id="menubar">
48 <div id="menubar">
49 <div class="navbar">
49 <div class="navbar">
50 <div class="navbar-inner">
50 <div class="navbar-inner">
51 <div class="container">
51 <div class="container">
52 <ul id="menus" class="nav">
52 <ul id="menus" class="nav">
53 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
53 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
54 <ul id="file_menu" class="dropdown-menu">
54 <ul id="file_menu" class="dropdown-menu">
55 <li id="new_notebook"
55 <li id="new_notebook"
56 title="Make a new notebook (Opens a new window)">
56 title="Make a new notebook (Opens a new window)">
57 <a href="#">New</a></li>
57 <a href="#">New</a></li>
58 <li id="open_notebook"
58 <li id="open_notebook"
59 title="Opens a new window with the Dashboard view">
59 title="Opens a new window with the Dashboard view">
60 <a href="#">Open...</a></li>
60 <a href="#">Open...</a></li>
61 <!-- <hr/> -->
61 <!-- <hr/> -->
62 <li class="divider"></li>
62 <li class="divider"></li>
63 <li id="copy_notebook"
63 <li id="copy_notebook"
64 title="Open a copy of this notebook's contents and start a new kernel">
64 title="Open a copy of this notebook's contents and start a new kernel">
65 <a href="#">Make a Copy...</a></li>
65 <a href="#">Make a Copy...</a></li>
66 <li id="rename_notebook"><a href="#">Rename...</a></li>
66 <li id="rename_notebook"><a href="#">Rename...</a></li>
67 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
67 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
68 <!-- <hr/> -->
68 <!-- <hr/> -->
69 <li class="divider"></li>
69 <li class="divider"></li>
70 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
70 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
71 <ul class="dropdown-menu">
71 <ul class="dropdown-menu">
72 <li><a href="#"></a></li>
72 <li><a href="#"></a></li>
73 <li><a href="#"></a></li>
73 <li><a href="#"></a></li>
74 <li><a href="#"></a></li>
74 <li><a href="#"></a></li>
75 <li><a href="#"></a></li>
75 <li><a href="#"></a></li>
76 <li><a href="#"></a></li>
76 <li><a href="#"></a></li>
77 </ul>
77 </ul>
78 </li>
78 </li>
79 <li class="divider"></li>
79 <li class="divider"></li>
80 <li id="print_preview"><a href="#">Print Preview</a></li>
80 <li id="print_preview"><a href="#">Print Preview</a></li>
81 <li class="dropdown-submenu"><a href="#">Download as</a>
81 <li class="dropdown-submenu"><a href="#">Download as</a>
82 <ul class="dropdown-menu">
82 <ul class="dropdown-menu">
83 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
83 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
84 <li id="download_py"><a href="#">Python (.py)</a></li>
84 <li id="download_py"><a href="#">Python (.py)</a></li>
85 <li id="download_html"><a href="#">HTML (.html)</a></li>
85 <li id="download_html"><a href="#">HTML (.html)</a></li>
86 <li id="download_rst"><a href="#">reST (.rst)</a></li>
86 <li id="download_rst"><a href="#">reST (.rst)</a></li>
87 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
87 </ul>
88 </ul>
88 </li>
89 </li>
89 <li class="divider"></li>
90 <li class="divider"></li>
90 <li id="trust_notebook"
91 <li id="trust_notebook"
91 title="Trust the output of this notebook">
92 title="Trust the output of this notebook">
92 <a href="#" >Trust Notebook</a></li>
93 <a href="#" >Trust Notebook</a></li>
93 <li class="divider"></li>
94 <li class="divider"></li>
94 <li id="kill_and_exit"
95 <li id="kill_and_exit"
95 title="Shutdown this notebook's kernel, and close this window">
96 title="Shutdown this notebook's kernel, and close this window">
96 <a href="#" >Close and halt</a></li>
97 <a href="#" >Close and halt</a></li>
97 </ul>
98 </ul>
98 </li>
99 </li>
99 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
100 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
100 <ul id="edit_menu" class="dropdown-menu">
101 <ul id="edit_menu" class="dropdown-menu">
101 <li id="cut_cell"><a href="#">Cut Cell</a></li>
102 <li id="cut_cell"><a href="#">Cut Cell</a></li>
102 <li id="copy_cell"><a href="#">Copy Cell</a></li>
103 <li id="copy_cell"><a href="#">Copy Cell</a></li>
103 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
104 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
104 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
105 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
105 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
106 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
106 <li id="delete_cell"><a href="#">Delete Cell</a></li>
107 <li id="delete_cell"><a href="#">Delete Cell</a></li>
107 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
108 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
108 <li class="divider"></li>
109 <li class="divider"></li>
109 <li id="split_cell"><a href="#">Split Cell</a></li>
110 <li id="split_cell"><a href="#">Split Cell</a></li>
110 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
111 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
111 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
112 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
112 <li class="divider"></li>
113 <li class="divider"></li>
113 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
114 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
114 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
115 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
115 <li class="divider"></li>
116 <li class="divider"></li>
116 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
117 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
117 </ul>
118 </ul>
118 </li>
119 </li>
119 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
120 <ul id="view_menu" class="dropdown-menu">
121 <ul id="view_menu" class="dropdown-menu">
121 <li id="toggle_header"
122 <li id="toggle_header"
122 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
123 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
123 <a href="#">Toggle Header</a></li>
124 <a href="#">Toggle Header</a></li>
124 <li id="toggle_toolbar"
125 <li id="toggle_toolbar"
125 title="Show/Hide the action icons (below menu bar)">
126 title="Show/Hide the action icons (below menu bar)">
126 <a href="#">Toggle Toolbar</a></li>
127 <a href="#">Toggle Toolbar</a></li>
127 </ul>
128 </ul>
128 </li>
129 </li>
129 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
130 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
130 <ul id="insert_menu" class="dropdown-menu">
131 <ul id="insert_menu" class="dropdown-menu">
131 <li id="insert_cell_above"
132 <li id="insert_cell_above"
132 title="Insert an empty Code cell above the currently active cell">
133 title="Insert an empty Code cell above the currently active cell">
133 <a href="#">Insert Cell Above</a></li>
134 <a href="#">Insert Cell Above</a></li>
134 <li id="insert_cell_below"
135 <li id="insert_cell_below"
135 title="Insert an empty Code cell below the currently active cell">
136 title="Insert an empty Code cell below the currently active cell">
136 <a href="#">Insert Cell Below</a></li>
137 <a href="#">Insert Cell Below</a></li>
137 </ul>
138 </ul>
138 </li>
139 </li>
139 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
140 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
140 <ul id="cell_menu" class="dropdown-menu">
141 <ul id="cell_menu" class="dropdown-menu">
141 <li id="run_cell" title="Run this cell, and move cursor to the next one">
142 <li id="run_cell" title="Run this cell, and move cursor to the next one">
142 <a href="#">Run</a></li>
143 <a href="#">Run</a></li>
143 <li id="run_cell_select_below" title="Run this cell, select below">
144 <li id="run_cell_select_below" title="Run this cell, select below">
144 <a href="#">Run and Select Below</a></li>
145 <a href="#">Run and Select Below</a></li>
145 <li id="run_cell_insert_below" title="Run this cell, insert below">
146 <li id="run_cell_insert_below" title="Run this cell, insert below">
146 <a href="#">Run and Insert Below</a></li>
147 <a href="#">Run and Insert Below</a></li>
147 <li id="run_all_cells" title="Run all cells in the notebook">
148 <li id="run_all_cells" title="Run all cells in the notebook">
148 <a href="#">Run All</a></li>
149 <a href="#">Run All</a></li>
149 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
150 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
150 <a href="#">Run All Above</a></li>
151 <a href="#">Run All Above</a></li>
151 <li id="run_all_cells_below" title="Run this cell and all cells below it">
152 <li id="run_all_cells_below" title="Run this cell and all cells below it">
152 <a href="#">Run All Below</a></li>
153 <a href="#">Run All Below</a></li>
153 <li class="divider"></li>
154 <li class="divider"></li>
154 <li id="change_cell_type" class="dropdown-submenu"
155 <li id="change_cell_type" class="dropdown-submenu"
155 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
156 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
156 <a href="#">Cell Type</a>
157 <a href="#">Cell Type</a>
157 <ul class="dropdown-menu">
158 <ul class="dropdown-menu">
158 <li id="to_code"
159 <li id="to_code"
159 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
160 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
160 <a href="#">Code</a></li>
161 <a href="#">Code</a></li>
161 <li id="to_markdown"
162 <li id="to_markdown"
162 title="Contents will be rendered as HTML and serve as explanatory text">
163 title="Contents will be rendered as HTML and serve as explanatory text">
163 <a href="#">Markdown</a></li>
164 <a href="#">Markdown</a></li>
164 <li id="to_raw"
165 <li id="to_raw"
165 title="Contents will pass through nbconvert unmodified">
166 title="Contents will pass through nbconvert unmodified">
166 <a href="#">Raw NBConvert</a></li>
167 <a href="#">Raw NBConvert</a></li>
167 <li id="to_heading1"><a href="#">Heading 1</a></li>
168 <li id="to_heading1"><a href="#">Heading 1</a></li>
168 <li id="to_heading2"><a href="#">Heading 2</a></li>
169 <li id="to_heading2"><a href="#">Heading 2</a></li>
169 <li id="to_heading3"><a href="#">Heading 3</a></li>
170 <li id="to_heading3"><a href="#">Heading 3</a></li>
170 <li id="to_heading4"><a href="#">Heading 4</a></li>
171 <li id="to_heading4"><a href="#">Heading 4</a></li>
171 <li id="to_heading5"><a href="#">Heading 5</a></li>
172 <li id="to_heading5"><a href="#">Heading 5</a></li>
172 <li id="to_heading6"><a href="#">Heading 6</a></li>
173 <li id="to_heading6"><a href="#">Heading 6</a></li>
173 </ul>
174 </ul>
174 </li>
175 </li>
175 <li class="divider"></li>
176 <li class="divider"></li>
176 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
177 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
177 <ul class="dropdown-menu">
178 <ul class="dropdown-menu">
178 <li id="toggle_current_output"
179 <li id="toggle_current_output"
179 title="Hide/Show the output of the current cell">
180 title="Hide/Show the output of the current cell">
180 <a href="#">Toggle</a>
181 <a href="#">Toggle</a>
181 </li>
182 </li>
182 <li id="toggle_current_output_scroll"
183 <li id="toggle_current_output_scroll"
183 title="Scroll the output of the current cell">
184 title="Scroll the output of the current cell">
184 <a href="#">Toggle Scrolling</a>
185 <a href="#">Toggle Scrolling</a>
185 </li>
186 </li>
186 <li id="clear_current_output"
187 <li id="clear_current_output"
187 title="Clear the output of the current cell">
188 title="Clear the output of the current cell">
188 <a href="#">Clear</a>
189 <a href="#">Clear</a>
189 </li>
190 </li>
190 </ul>
191 </ul>
191 </li>
192 </li>
192 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
193 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
193 <ul class="dropdown-menu">
194 <ul class="dropdown-menu">
194 <li id="toggle_all_output"
195 <li id="toggle_all_output"
195 title="Hide/Show the output of all cells">
196 title="Hide/Show the output of all cells">
196 <a href="#">Toggle</a>
197 <a href="#">Toggle</a>
197 </li>
198 </li>
198 <li id="toggle_all_output_scroll"
199 <li id="toggle_all_output_scroll"
199 title="Scroll the output of all cells">
200 title="Scroll the output of all cells">
200 <a href="#">Toggle Scrolling</a>
201 <a href="#">Toggle Scrolling</a>
201 </li>
202 </li>
202 <li id="clear_all_output"
203 <li id="clear_all_output"
203 title="Clear the output of all cells">
204 title="Clear the output of all cells">
204 <a href="#">Clear</a>
205 <a href="#">Clear</a>
205 </li>
206 </li>
206 </ul>
207 </ul>
207 </li>
208 </li>
208 </ul>
209 </ul>
209 </li>
210 </li>
210 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
211 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
211 <ul id="kernel_menu" class="dropdown-menu">
212 <ul id="kernel_menu" class="dropdown-menu">
212 <li id="int_kernel"
213 <li id="int_kernel"
213 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
214 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
214 <a href="#">Interrupt</a></li>
215 <a href="#">Interrupt</a></li>
215 <li id="restart_kernel"
216 <li id="restart_kernel"
216 title="Restart the Kernel">
217 title="Restart the Kernel">
217 <a href="#">Restart</a></li>
218 <a href="#">Restart</a></li>
218 </ul>
219 </ul>
219 </li>
220 </li>
220 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
221 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
221 <ul id="help_menu" class="dropdown-menu">
222 <ul id="help_menu" class="dropdown-menu">
222 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
223 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
223 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
224 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
224 <li class="divider"></li>
225 <li class="divider"></li>
225 {% set
226 {% set
226 sections = (
227 sections = (
227 (
228 (
228 ("http://ipython.org/documentation.html","IPython Help",True),
229 ("http://ipython.org/documentation.html","IPython Help",True),
229 ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True),
230 ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True),
230 ),(
231 ),(
231 ("http://docs.python.org","Python",True),
232 ("http://docs.python.org","Python",True),
232 ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True),
233 ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True),
233 ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True),
234 ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True),
234 ("http://matplotlib.org/contents.html","Matplotlib",True),
235 ("http://matplotlib.org/contents.html","Matplotlib",True),
235 ("http://docs.sympy.org/latest/index.html","SymPy",True),
236 ("http://docs.sympy.org/latest/index.html","SymPy",True),
236 ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True)
237 ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True)
237 )
238 )
238 )
239 )
239 %}
240 %}
240
241
241 {% for helplinks in sections %}
242 {% for helplinks in sections %}
242 {% for link in helplinks %}
243 {% for link in helplinks %}
243 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
244 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
244 {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}}
245 {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}}
245 {{link[1]}}
246 {{link[1]}}
246 </a></li>
247 </a></li>
247 {% endfor %}
248 {% endfor %}
248 {% if not loop.last %}
249 {% if not loop.last %}
249 <li class="divider"></li>
250 <li class="divider"></li>
250 {% endif %}
251 {% endif %}
251 {% endfor %}
252 {% endfor %}
252 </li>
253 </li>
253 </ul>
254 </ul>
254 </li>
255 </li>
255 </ul>
256 </ul>
256 <div id="kernel_indicator" class="indicator_area pull-right">
257 <div id="kernel_indicator" class="indicator_area pull-right">
257 <i id="kernel_indicator_icon"></i>
258 <i id="kernel_indicator_icon"></i>
258 </div>
259 </div>
259 <div id="modal_indicator" class="indicator_area pull-right">
260 <div id="modal_indicator" class="indicator_area pull-right">
260 <i id="modal_indicator_icon"></i>
261 <i id="modal_indicator_icon"></i>
261 </div>
262 </div>
262 <div id="notification_area"></div>
263 <div id="notification_area"></div>
263 </div>
264 </div>
264 </div>
265 </div>
265 </div>
266 </div>
266 </div>
267 </div>
267 <div id="maintoolbar" class="navbar">
268 <div id="maintoolbar" class="navbar">
268 <div class="toolbar-inner navbar-inner navbar-nobg">
269 <div class="toolbar-inner navbar-inner navbar-nobg">
269 <div id="maintoolbar-container" class="container"></div>
270 <div id="maintoolbar-container" class="container"></div>
270 </div>
271 </div>
271 </div>
272 </div>
272 </div>
273 </div>
273
274
274 <div id="ipython-main-app">
275 <div id="ipython-main-app">
275
276
276 <div id="notebook_panel">
277 <div id="notebook_panel">
277 <div id="notebook"></div>
278 <div id="notebook"></div>
278 <div id="pager_splitter"></div>
279 <div id="pager_splitter"></div>
279 <div id="pager">
280 <div id="pager">
280 <div id='pager_button_area'>
281 <div id='pager_button_area'>
281 </div>
282 </div>
282 <div id="pager-container" class="container"></div>
283 <div id="pager-container" class="container"></div>
283 </div>
284 </div>
284 </div>
285 </div>
285
286
286 </div>
287 </div>
287 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
288 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
288
289
289
290
290 {% endblock %}
291 {% endblock %}
291
292
292
293
293 {% block script %}
294 {% block script %}
294
295
295 {{super()}}
296 {{super()}}
296
297
297 <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script>
298 <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script>
298 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
299 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
299 <script type="text/javascript">
300 <script type="text/javascript">
300 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
301 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
301 </script>
302 </script>
302 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
303 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
303 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
304 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
304 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
305 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
305 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
306 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
306 <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
307 <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
307 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
308 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
308 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
309 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
309 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
310 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
310 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
311 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
311 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
312 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
312 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
313 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
313 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
314 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
314 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
315 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
315 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
316 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
316 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
317
318
318 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
319 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
319
320
320 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
321 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
321
322
322 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
323 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
323 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
324 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
324 <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script>
325 <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script>
325 <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script>
326 <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script>
326 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
327 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
327 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
328 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
328 <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script>
329 <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script>
329 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
330 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
330 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
331 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
331 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
332 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
332 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
333 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
333 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
334 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
334 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
335 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
335 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
336 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
336 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
337 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
337 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
338 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
338 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
339 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
339 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
340 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
340 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
341 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
341 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
342 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
342 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
343 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
343 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
344 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
344 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
345 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
345 <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script>
346 <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script>
346 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
347 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
347 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
349 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
349 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
350 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
350
351
351 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
352 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
352 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
353 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
353
354
354 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
355 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
355
356
356 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
357 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
357 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
358 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
358 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
359 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
359
360
360 {% endblock %}
361 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now