##// END OF EJS Templates
disable download-as-pt...
MinRK -
Show More
@@ -1,245 +1,245 b''
1 """Tornado handlers for the notebooks web service.
1 """Tornado handlers for the notebooks web service.
2
2
3 Authors:
3 Authors:
4
4
5 * Brian Granger
5 * Brian Granger
6 """
6 """
7
7
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2008-2011 The IPython Development Team
9 # Copyright (C) 2008-2011 The IPython Development Team
10 #
10 #
11 # Distributed under the terms of the BSD License. The full license is in
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
12 # the file COPYING, distributed as part of this software.
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16 # Imports
16 # Imports
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18
18
19 import json
19 import json
20
20
21 from tornado import web
21 from tornado import web
22
22
23 from IPython.html.utils import url_path_join
23 from IPython.html.utils import url_path_join
24 from IPython.utils.jsonutil import date_default
24 from IPython.utils.jsonutil import date_default
25
25
26 from IPython.html.base.handlers import IPythonHandler, json_errors
26 from IPython.html.base.handlers import IPythonHandler, json_errors
27
27
28 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29 # Notebook web service handlers
29 # Notebook web service handlers
30 #-----------------------------------------------------------------------------
30 #-----------------------------------------------------------------------------
31
31
32
32
33 class NotebookHandler(IPythonHandler):
33 class NotebookHandler(IPythonHandler):
34
34
35 SUPPORTED_METHODS = (u'GET', u'PUT', u'PATCH', u'POST', u'DELETE')
35 SUPPORTED_METHODS = (u'GET', u'PUT', u'PATCH', u'POST', u'DELETE')
36
36
37 def notebook_location(self, name, path=''):
37 def notebook_location(self, name, path=''):
38 """Return the full URL location of a notebook based.
38 """Return the full URL location of a notebook based.
39
39
40 Parameters
40 Parameters
41 ----------
41 ----------
42 name : unicode
42 name : unicode
43 The base name of the notebook, such as "foo.ipynb".
43 The base name of the notebook, such as "foo.ipynb".
44 path : unicode
44 path : unicode
45 The URL path of the notebook.
45 The URL path of the notebook.
46 """
46 """
47 return url_path_join(self.base_project_url, 'api', 'notebooks', path, name)
47 return url_path_join(self.base_project_url, 'api', 'notebooks', path, name)
48
48
49 @web.authenticated
49 @web.authenticated
50 @json_errors
50 @json_errors
51 def get(self, path='', name=None):
51 def get(self, path='', name=None):
52 """
52 """
53 GET with path and no notebook lists notebooks in a directory
53 GET with path and no notebook lists notebooks in a directory
54 GET with path and notebook name
54 GET with path and notebook name
55
55
56 GET get checks if a notebook is not named, an returns a list of notebooks
56 GET get checks if a notebook is not named, an returns a list of notebooks
57 in the notebook path given. If a name is given, return
57 in the notebook path given. If a name is given, return
58 the notebook representation"""
58 the notebook representation"""
59 nbm = self.notebook_manager
59 nbm = self.notebook_manager
60 # Check to see if a notebook name was given
60 # Check to see if a notebook name was given
61 if name is None:
61 if name is None:
62 # List notebooks in 'path'
62 # List notebooks in 'path'
63 notebooks = nbm.list_notebooks(path)
63 notebooks = nbm.list_notebooks(path)
64 self.finish(json.dumps(notebooks, default=date_default))
64 self.finish(json.dumps(notebooks, default=date_default))
65 return
65 return
66 # get and return notebook representation
66 # get and return notebook representation
67 model = nbm.get_notebook_model(name, path)
67 model = nbm.get_notebook_model(name, path)
68 self.set_header(u'Last-Modified', model[u'last_modified'])
68 self.set_header(u'Last-Modified', model[u'last_modified'])
69
69
70 if self.get_argument('download', default='False') == 'True':
70 if self.get_argument('download', default='False') == 'True':
71 format = self.get_argument('format', default='json')
71 format = self.get_argument('format', default='json')
72 if format == u'json':
72 if format != u'json':
73 self.set_header('Content-Type', 'application/json')
73 self.set_header('Content-Type', 'application/json')
74 raise web.HTTPError(400, "Unrecognized format: %s" % ext)
74 raise web.HTTPError(400, "Unrecognized format: %s" % format)
75
75
76 self.set_header('Content-Disposition',
76 self.set_header('Content-Disposition',
77 'attachment; filename="%s"' % name
77 'attachment; filename="%s"' % name
78 )
78 )
79 self.finish(json.dumps(model['content'], default=date_default))
79 self.finish(json.dumps(model['content'], default=date_default))
80 else:
80 else:
81 self.finish(json.dumps(model, default=date_default))
81 self.finish(json.dumps(model, default=date_default))
82
82
83 @web.authenticated
83 @web.authenticated
84 @json_errors
84 @json_errors
85 def patch(self, path='', name=None):
85 def patch(self, path='', name=None):
86 """PATCH renames a notebook without re-uploading content."""
86 """PATCH renames a notebook without re-uploading content."""
87 nbm = self.notebook_manager
87 nbm = self.notebook_manager
88 if name is None:
88 if name is None:
89 raise web.HTTPError(400, u'Notebook name missing')
89 raise web.HTTPError(400, u'Notebook name missing')
90 model = self.get_json_body()
90 model = self.get_json_body()
91 if model is None:
91 if model is None:
92 raise web.HTTPError(400, u'JSON body missing')
92 raise web.HTTPError(400, u'JSON body missing')
93 model = nbm.update_notebook_model(model, name, path)
93 model = nbm.update_notebook_model(model, name, path)
94 location = self.notebook_location(model[u'name'], model[u'path'])
94 location = self.notebook_location(model[u'name'], model[u'path'])
95 self.set_header(u'Location', location)
95 self.set_header(u'Location', location)
96 self.set_header(u'Last-Modified', model[u'last_modified'])
96 self.set_header(u'Last-Modified', model[u'last_modified'])
97 self.finish(json.dumps(model, default=date_default))
97 self.finish(json.dumps(model, default=date_default))
98
98
99 @web.authenticated
99 @web.authenticated
100 @json_errors
100 @json_errors
101 def post(self, path='', name=None):
101 def post(self, path='', name=None):
102 """Create a new notebook in the specified path.
102 """Create a new notebook in the specified path.
103
103
104 POST creates new notebooks.
104 POST creates new notebooks.
105
105
106 POST /api/notebooks/path : new untitled notebook in path
106 POST /api/notebooks/path : new untitled notebook in path
107 POST /api/notebooks/path/notebook.ipynb : new notebook with name in path
107 POST /api/notebooks/path/notebook.ipynb : new notebook with name in path
108 If content specified upload notebook, otherwise start empty.
108 If content specified upload notebook, otherwise start empty.
109 """
109 """
110 nbm = self.notebook_manager
110 nbm = self.notebook_manager
111 model = self.get_json_body()
111 model = self.get_json_body()
112 if name is None:
112 if name is None:
113 # creating new notebook, model doesn't make sense
113 # creating new notebook, model doesn't make sense
114 if model is not None:
114 if model is not None:
115 raise web.HTTPError(400, "Model not valid when creating untitled notebooks.")
115 raise web.HTTPError(400, "Model not valid when creating untitled notebooks.")
116 model = nbm.create_notebook_model(path=path)
116 model = nbm.create_notebook_model(path=path)
117 else:
117 else:
118 if model is None:
118 if model is None:
119 self.log.info("Creating new Notebook at %s/%s", path, name)
119 self.log.info("Creating new Notebook at %s/%s", path, name)
120 model = {}
120 model = {}
121 else:
121 else:
122 self.log.info("Uploading Notebook to %s/%s", path, name)
122 self.log.info("Uploading Notebook to %s/%s", path, name)
123 # set the model name from the URL
123 # set the model name from the URL
124 model['name'] = name
124 model['name'] = name
125 model = nbm.create_notebook_model(model, path)
125 model = nbm.create_notebook_model(model, path)
126
126
127 location = self.notebook_location(model[u'name'], model[u'path'])
127 location = self.notebook_location(model[u'name'], model[u'path'])
128 self.set_header(u'Location', location)
128 self.set_header(u'Location', location)
129 self.set_header(u'Last-Modified', model[u'last_modified'])
129 self.set_header(u'Last-Modified', model[u'last_modified'])
130 self.set_status(201)
130 self.set_status(201)
131 self.finish(json.dumps(model, default=date_default))
131 self.finish(json.dumps(model, default=date_default))
132
132
133 @web.authenticated
133 @web.authenticated
134 @json_errors
134 @json_errors
135 def put(self, path='', name=None):
135 def put(self, path='', name=None):
136 """saves the notebook in the location given by 'notebook_path'."""
136 """saves the notebook in the location given by 'notebook_path'."""
137 nbm = self.notebook_manager
137 nbm = self.notebook_manager
138 model = self.get_json_body()
138 model = self.get_json_body()
139 if model is None:
139 if model is None:
140 raise web.HTTPError(400, u'JSON body missing')
140 raise web.HTTPError(400, u'JSON body missing')
141 nbm.save_notebook_model(model, name, path)
141 nbm.save_notebook_model(model, name, path)
142 self.finish(json.dumps(model, default=date_default))
142 self.finish(json.dumps(model, default=date_default))
143
143
144 @web.authenticated
144 @web.authenticated
145 @json_errors
145 @json_errors
146 def delete(self, path='', name=None):
146 def delete(self, path='', name=None):
147 """delete the notebook in the given notebook path"""
147 """delete the notebook in the given notebook path"""
148 nbm = self.notebook_manager
148 nbm = self.notebook_manager
149 nbm.delete_notebook_model(name, path)
149 nbm.delete_notebook_model(name, path)
150 self.set_status(204)
150 self.set_status(204)
151 self.finish()
151 self.finish()
152
152
153 class NotebookCopyHandler(IPythonHandler):
153 class NotebookCopyHandler(IPythonHandler):
154
154
155 SUPPORTED_METHODS = ('POST')
155 SUPPORTED_METHODS = ('POST')
156
156
157 @web.authenticated
157 @web.authenticated
158 @json_errors
158 @json_errors
159 def post(self, path='', name=None):
159 def post(self, path='', name=None):
160 """Copy an existing notebook."""
160 """Copy an existing notebook."""
161 nbm = self.notebook_manager
161 nbm = self.notebook_manager
162 model = self.get_json_body()
162 model = self.get_json_body()
163 if name is None:
163 if name is None:
164 raise web.HTTPError(400, "Notebook name required")
164 raise web.HTTPError(400, "Notebook name required")
165 self.log.info("Copying Notebook %s/%s", path, name)
165 self.log.info("Copying Notebook %s/%s", path, name)
166 model = nbm.copy_notebook(name, path)
166 model = nbm.copy_notebook(name, path)
167 location = url_path_join(
167 location = url_path_join(
168 self.base_project_url, 'api', 'notebooks',
168 self.base_project_url, 'api', 'notebooks',
169 model['path'], model['name'],
169 model['path'], model['name'],
170 )
170 )
171 self.set_header(u'Location', location)
171 self.set_header(u'Location', location)
172 self.set_header(u'Last-Modified', model[u'last_modified'])
172 self.set_header(u'Last-Modified', model[u'last_modified'])
173 self.set_status(201)
173 self.set_status(201)
174 self.finish(json.dumps(model, default=date_default))
174 self.finish(json.dumps(model, default=date_default))
175
175
176
176
177 class NotebookCheckpointsHandler(IPythonHandler):
177 class NotebookCheckpointsHandler(IPythonHandler):
178
178
179 SUPPORTED_METHODS = ('GET', 'POST')
179 SUPPORTED_METHODS = ('GET', 'POST')
180
180
181 @web.authenticated
181 @web.authenticated
182 @json_errors
182 @json_errors
183 def get(self, path='', name=None):
183 def get(self, path='', name=None):
184 """get lists checkpoints for a notebook"""
184 """get lists checkpoints for a notebook"""
185 nbm = self.notebook_manager
185 nbm = self.notebook_manager
186 checkpoints = nbm.list_checkpoints(name, path)
186 checkpoints = nbm.list_checkpoints(name, path)
187 data = json.dumps(checkpoints, default=date_default)
187 data = json.dumps(checkpoints, default=date_default)
188 self.finish(data)
188 self.finish(data)
189
189
190 @web.authenticated
190 @web.authenticated
191 @json_errors
191 @json_errors
192 def post(self, path='', name=None):
192 def post(self, path='', name=None):
193 """post creates a new checkpoint"""
193 """post creates a new checkpoint"""
194 nbm = self.notebook_manager
194 nbm = self.notebook_manager
195 checkpoint = nbm.create_checkpoint(name, path)
195 checkpoint = nbm.create_checkpoint(name, path)
196 data = json.dumps(checkpoint, default=date_default)
196 data = json.dumps(checkpoint, default=date_default)
197 location = url_path_join(self.base_project_url, u'/api/notebooks',
197 location = url_path_join(self.base_project_url, u'/api/notebooks',
198 path, name, 'checkpoints', checkpoint[u'checkpoint_id'])
198 path, name, 'checkpoints', checkpoint[u'checkpoint_id'])
199 self.set_header(u'Location', location)
199 self.set_header(u'Location', location)
200 self.finish(data)
200 self.finish(data)
201
201
202
202
203 class ModifyNotebookCheckpointsHandler(IPythonHandler):
203 class ModifyNotebookCheckpointsHandler(IPythonHandler):
204
204
205 SUPPORTED_METHODS = ('POST', 'DELETE')
205 SUPPORTED_METHODS = ('POST', 'DELETE')
206
206
207 @web.authenticated
207 @web.authenticated
208 @json_errors
208 @json_errors
209 def post(self, path, name, checkpoint_id):
209 def post(self, path, name, checkpoint_id):
210 """post restores a notebook from a checkpoint"""
210 """post restores a notebook from a checkpoint"""
211 nbm = self.notebook_manager
211 nbm = self.notebook_manager
212 nbm.restore_checkpoint(checkpoint_id, name, path)
212 nbm.restore_checkpoint(checkpoint_id, name, path)
213 self.set_status(204)
213 self.set_status(204)
214 self.finish()
214 self.finish()
215
215
216 @web.authenticated
216 @web.authenticated
217 @json_errors
217 @json_errors
218 def delete(self, path, name, checkpoint_id):
218 def delete(self, path, name, checkpoint_id):
219 """delete clears a checkpoint for a given notebook"""
219 """delete clears a checkpoint for a given notebook"""
220 nbm = self.notebook_manager
220 nbm = self.notebook_manager
221 nbm.delete_checkpoint(checkpoint_id, name, path)
221 nbm.delete_checkpoint(checkpoint_id, name, path)
222 self.set_status(204)
222 self.set_status(204)
223 self.finish()
223 self.finish()
224
224
225 #-----------------------------------------------------------------------------
225 #-----------------------------------------------------------------------------
226 # URL to handler mappings
226 # URL to handler mappings
227 #-----------------------------------------------------------------------------
227 #-----------------------------------------------------------------------------
228
228
229
229
230 _path_regex = r"(?P<path>(?:/.*)*)"
230 _path_regex = r"(?P<path>(?:/.*)*)"
231 _checkpoint_id_regex = r"(?P<checkpoint_id>[\w-]+)"
231 _checkpoint_id_regex = r"(?P<checkpoint_id>[\w-]+)"
232 _notebook_name_regex = r"(?P<name>[^/]+\.ipynb)"
232 _notebook_name_regex = r"(?P<name>[^/]+\.ipynb)"
233 _notebook_path_regex = "%s/%s" % (_path_regex, _notebook_name_regex)
233 _notebook_path_regex = "%s/%s" % (_path_regex, _notebook_name_regex)
234
234
235 default_handlers = [
235 default_handlers = [
236 (r"/api/notebooks%s/copy" % _notebook_path_regex, NotebookCopyHandler),
236 (r"/api/notebooks%s/copy" % _notebook_path_regex, NotebookCopyHandler),
237 (r"/api/notebooks%s/checkpoints" % _notebook_path_regex, NotebookCheckpointsHandler),
237 (r"/api/notebooks%s/checkpoints" % _notebook_path_regex, NotebookCheckpointsHandler),
238 (r"/api/notebooks%s/checkpoints/%s" % (_notebook_path_regex, _checkpoint_id_regex),
238 (r"/api/notebooks%s/checkpoints/%s" % (_notebook_path_regex, _checkpoint_id_regex),
239 ModifyNotebookCheckpointsHandler),
239 ModifyNotebookCheckpointsHandler),
240 (r"/api/notebooks%s" % _notebook_path_regex, NotebookHandler),
240 (r"/api/notebooks%s" % _notebook_path_regex, NotebookHandler),
241 (r"/api/notebooks%s" % _path_regex, NotebookHandler),
241 (r"/api/notebooks%s" % _path_regex, NotebookHandler),
242 ]
242 ]
243
243
244
244
245
245
@@ -1,298 +1,305 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2011 The IPython Development Team
2 // Copyright (C) 2008-2011 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 // MenuBar
9 // MenuBar
10 //============================================================================
10 //============================================================================
11
11
12 /**
12 /**
13 * @module IPython
13 * @module IPython
14 * @namespace IPython
14 * @namespace IPython
15 * @submodule MenuBar
15 * @submodule MenuBar
16 */
16 */
17
17
18
18
19 var IPython = (function (IPython) {
19 var IPython = (function (IPython) {
20 "use strict";
20 "use strict";
21
21
22 var utils = IPython.utils;
22 var utils = IPython.utils;
23
23
24 /**
24 /**
25 * A MenuBar Class to generate the menubar of IPython notebook
25 * A MenuBar Class to generate the menubar of IPython notebook
26 * @Class MenuBar
26 * @Class MenuBar
27 *
27 *
28 * @constructor
28 * @constructor
29 *
29 *
30 *
30 *
31 * @param selector {string} selector for the menubar element in DOM
31 * @param selector {string} selector for the menubar element in DOM
32 * @param {object} [options]
32 * @param {object} [options]
33 * @param [options.baseProjectUrl] {String} String to use for the
33 * @param [options.baseProjectUrl] {String} String to use for the
34 * Base Project url, default would be to inspect
34 * Base Project url, default would be to inspect
35 * $('body').data('baseProjectUrl');
35 * $('body').data('baseProjectUrl');
36 * does not support change for now is set through this option
36 * does not support change for now is set through this option
37 */
37 */
38 var MenuBar = function (selector, options) {
38 var MenuBar = function (selector, options) {
39 options = options || {};
39 options = options || {};
40 if (options.baseProjectUrl !== undefined) {
40 if (options.baseProjectUrl !== undefined) {
41 this._baseProjectUrl = options.baseProjectUrl;
41 this._baseProjectUrl = options.baseProjectUrl;
42 }
42 }
43 this.selector = selector;
43 this.selector = selector;
44 if (this.selector !== undefined) {
44 if (this.selector !== undefined) {
45 this.element = $(selector);
45 this.element = $(selector);
46 this.style();
46 this.style();
47 this.bind_events();
47 this.bind_events();
48 }
48 }
49 };
49 };
50
50
51 MenuBar.prototype.baseProjectUrl = function(){
51 MenuBar.prototype.baseProjectUrl = function(){
52 return this._baseProjectUrl || $('body').data('baseProjectUrl');
52 return this._baseProjectUrl || $('body').data('baseProjectUrl');
53 };
53 };
54
54
55 MenuBar.prototype.notebookPath = function() {
55 MenuBar.prototype.notebookPath = function() {
56 var path = $('body').data('notebookPath');
56 var path = $('body').data('notebookPath');
57 path = decodeURIComponent(path);
57 path = decodeURIComponent(path);
58 return path;
58 return path;
59 };
59 };
60
60
61 MenuBar.prototype.style = function () {
61 MenuBar.prototype.style = function () {
62 this.element.addClass('border-box-sizing');
62 this.element.addClass('border-box-sizing');
63 this.element.find("li").click(function (event, ui) {
63 this.element.find("li").click(function (event, ui) {
64 // The selected cell loses focus when the menu is entered, so we
64 // The selected cell loses focus when the menu is entered, so we
65 // re-select it upon selection.
65 // re-select it upon selection.
66 var i = IPython.notebook.get_selected_index();
66 var i = IPython.notebook.get_selected_index();
67 IPython.notebook.select(i);
67 IPython.notebook.select(i);
68 }
68 }
69 );
69 );
70 };
70 };
71
71
72
72
73 MenuBar.prototype.bind_events = function () {
73 MenuBar.prototype.bind_events = function () {
74 // File
74 // File
75 var that = this;
75 var that = this;
76 this.element.find('#new_notebook').click(function () {
76 this.element.find('#new_notebook').click(function () {
77 IPython.notebook.new_notebook();
77 IPython.notebook.new_notebook();
78 });
78 });
79 this.element.find('#open_notebook').click(function () {
79 this.element.find('#open_notebook').click(function () {
80 window.open(utils.url_path_join(
80 window.open(utils.url_path_join(
81 that.baseProjectUrl(),
81 that.baseProjectUrl(),
82 'tree',
82 'tree',
83 that.notebookPath()
83 that.notebookPath()
84 ));
84 ));
85 });
85 });
86 this.element.find('#copy_notebook').click(function () {
86 this.element.find('#copy_notebook').click(function () {
87 IPython.notebook.copy_notebook();
87 IPython.notebook.copy_notebook();
88 return false;
88 return false;
89 });
89 });
90 this.element.find('#download_ipynb').click(function () {
90 this.element.find('#download_ipynb').click(function () {
91 var notebook_name = IPython.notebook.get_notebook_name();
91 var notebook_name = IPython.notebook.get_notebook_name();
92 if (IPython.notebook.dirty) {
92 if (IPython.notebook.dirty) {
93 IPython.notebook.save_notebook({async : false});
93 IPython.notebook.save_notebook({async : false});
94 }
94 }
95
95
96 var url = utils.url_path_join(
96 var url = utils.url_path_join(
97 that.baseProjectUrl(),
97 that.baseProjectUrl(),
98 'api/notebooks',
98 'api/notebooks',
99 that.notebookPath(),
99 that.notebookPath(),
100 notebook_name + '.ipynb?format=json&download=True'
100 notebook_name + '.ipynb?format=json&download=True'
101 );
101 );
102 window.location.assign(url);
102 window.location.assign(url);
103 });
103 });
104
105 /* FIXME: download-as-py doesn't work right now
106 * We will need nbconvert hooked up to get this back
107
104 this.element.find('#download_py').click(function () {
108 this.element.find('#download_py').click(function () {
105 var notebook_name = IPython.notebook.get_notebook_name();
109 var notebook_name = IPython.notebook.get_notebook_name();
106 if (IPython.notebook.dirty) {
110 if (IPython.notebook.dirty) {
107 IPython.notebook.save_notebook({async : false});
111 IPython.notebook.save_notebook({async : false});
108 }
112 }
109 var url = utils.url_path_join(
113 var url = utils.url_path_join(
110 that.baseProjectUrl(),
114 that.baseProjectUrl(),
111 'api/notebooks',
115 'api/notebooks',
112 that.notebookPath(),
116 that.notebookPath(),
113 notebook_name + '.ipynb?format=py&download=True'
117 notebook_name + '.ipynb?format=py&download=True'
114 );
118 );
115 window.location.assign(url);
119 window.location.assign(url);
116 });
120 });
121
122 */
123
117 this.element.find('#rename_notebook').click(function () {
124 this.element.find('#rename_notebook').click(function () {
118 IPython.save_widget.rename_notebook();
125 IPython.save_widget.rename_notebook();
119 });
126 });
120 this.element.find('#save_checkpoint').click(function () {
127 this.element.find('#save_checkpoint').click(function () {
121 IPython.notebook.save_checkpoint();
128 IPython.notebook.save_checkpoint();
122 });
129 });
123 this.element.find('#restore_checkpoint').click(function () {
130 this.element.find('#restore_checkpoint').click(function () {
124 });
131 });
125 this.element.find('#kill_and_exit').click(function () {
132 this.element.find('#kill_and_exit').click(function () {
126 IPython.notebook.session.delete_session();
133 IPython.notebook.session.delete_session();
127 setTimeout(function(){window.close();}, 500);
134 setTimeout(function(){window.close();}, 500);
128 });
135 });
129 // Edit
136 // Edit
130 this.element.find('#cut_cell').click(function () {
137 this.element.find('#cut_cell').click(function () {
131 IPython.notebook.cut_cell();
138 IPython.notebook.cut_cell();
132 });
139 });
133 this.element.find('#copy_cell').click(function () {
140 this.element.find('#copy_cell').click(function () {
134 IPython.notebook.copy_cell();
141 IPython.notebook.copy_cell();
135 });
142 });
136 this.element.find('#delete_cell').click(function () {
143 this.element.find('#delete_cell').click(function () {
137 IPython.notebook.delete_cell();
144 IPython.notebook.delete_cell();
138 });
145 });
139 this.element.find('#undelete_cell').click(function () {
146 this.element.find('#undelete_cell').click(function () {
140 IPython.notebook.undelete();
147 IPython.notebook.undelete();
141 });
148 });
142 this.element.find('#split_cell').click(function () {
149 this.element.find('#split_cell').click(function () {
143 IPython.notebook.split_cell();
150 IPython.notebook.split_cell();
144 });
151 });
145 this.element.find('#merge_cell_above').click(function () {
152 this.element.find('#merge_cell_above').click(function () {
146 IPython.notebook.merge_cell_above();
153 IPython.notebook.merge_cell_above();
147 });
154 });
148 this.element.find('#merge_cell_below').click(function () {
155 this.element.find('#merge_cell_below').click(function () {
149 IPython.notebook.merge_cell_below();
156 IPython.notebook.merge_cell_below();
150 });
157 });
151 this.element.find('#move_cell_up').click(function () {
158 this.element.find('#move_cell_up').click(function () {
152 IPython.notebook.move_cell_up();
159 IPython.notebook.move_cell_up();
153 });
160 });
154 this.element.find('#move_cell_down').click(function () {
161 this.element.find('#move_cell_down').click(function () {
155 IPython.notebook.move_cell_down();
162 IPython.notebook.move_cell_down();
156 });
163 });
157 this.element.find('#select_previous').click(function () {
164 this.element.find('#select_previous').click(function () {
158 IPython.notebook.select_prev();
165 IPython.notebook.select_prev();
159 });
166 });
160 this.element.find('#select_next').click(function () {
167 this.element.find('#select_next').click(function () {
161 IPython.notebook.select_next();
168 IPython.notebook.select_next();
162 });
169 });
163 this.element.find('#edit_nb_metadata').click(function () {
170 this.element.find('#edit_nb_metadata').click(function () {
164 IPython.notebook.edit_metadata();
171 IPython.notebook.edit_metadata();
165 });
172 });
166
173
167 // View
174 // View
168 this.element.find('#toggle_header').click(function () {
175 this.element.find('#toggle_header').click(function () {
169 $('div#header').toggle();
176 $('div#header').toggle();
170 IPython.layout_manager.do_resize();
177 IPython.layout_manager.do_resize();
171 });
178 });
172 this.element.find('#toggle_toolbar').click(function () {
179 this.element.find('#toggle_toolbar').click(function () {
173 $('div#maintoolbar').toggle();
180 $('div#maintoolbar').toggle();
174 IPython.layout_manager.do_resize();
181 IPython.layout_manager.do_resize();
175 });
182 });
176 // Insert
183 // Insert
177 this.element.find('#insert_cell_above').click(function () {
184 this.element.find('#insert_cell_above').click(function () {
178 IPython.notebook.insert_cell_above('code');
185 IPython.notebook.insert_cell_above('code');
179 });
186 });
180 this.element.find('#insert_cell_below').click(function () {
187 this.element.find('#insert_cell_below').click(function () {
181 IPython.notebook.insert_cell_below('code');
188 IPython.notebook.insert_cell_below('code');
182 });
189 });
183 // Cell
190 // Cell
184 this.element.find('#run_cell').click(function () {
191 this.element.find('#run_cell').click(function () {
185 IPython.notebook.execute_selected_cell();
192 IPython.notebook.execute_selected_cell();
186 });
193 });
187 this.element.find('#run_cell_in_place').click(function () {
194 this.element.find('#run_cell_in_place').click(function () {
188 IPython.notebook.execute_selected_cell({terminal:true});
195 IPython.notebook.execute_selected_cell({terminal:true});
189 });
196 });
190 this.element.find('#run_all_cells').click(function () {
197 this.element.find('#run_all_cells').click(function () {
191 IPython.notebook.execute_all_cells();
198 IPython.notebook.execute_all_cells();
192 }).attr('title', 'Run all cells in the notebook');
199 }).attr('title', 'Run all cells in the notebook');
193 this.element.find('#run_all_cells_above').click(function () {
200 this.element.find('#run_all_cells_above').click(function () {
194 IPython.notebook.execute_cells_above();
201 IPython.notebook.execute_cells_above();
195 }).attr('title', 'Run all cells above (but not including) this cell');
202 }).attr('title', 'Run all cells above (but not including) this cell');
196 this.element.find('#run_all_cells_below').click(function () {
203 this.element.find('#run_all_cells_below').click(function () {
197 IPython.notebook.execute_cells_below();
204 IPython.notebook.execute_cells_below();
198 }).attr('title', 'Run this cell and all cells below it');
205 }).attr('title', 'Run this cell and all cells below it');
199 this.element.find('#to_code').click(function () {
206 this.element.find('#to_code').click(function () {
200 IPython.notebook.to_code();
207 IPython.notebook.to_code();
201 });
208 });
202 this.element.find('#to_markdown').click(function () {
209 this.element.find('#to_markdown').click(function () {
203 IPython.notebook.to_markdown();
210 IPython.notebook.to_markdown();
204 });
211 });
205 this.element.find('#to_raw').click(function () {
212 this.element.find('#to_raw').click(function () {
206 IPython.notebook.to_raw();
213 IPython.notebook.to_raw();
207 });
214 });
208 this.element.find('#to_heading1').click(function () {
215 this.element.find('#to_heading1').click(function () {
209 IPython.notebook.to_heading(undefined, 1);
216 IPython.notebook.to_heading(undefined, 1);
210 });
217 });
211 this.element.find('#to_heading2').click(function () {
218 this.element.find('#to_heading2').click(function () {
212 IPython.notebook.to_heading(undefined, 2);
219 IPython.notebook.to_heading(undefined, 2);
213 });
220 });
214 this.element.find('#to_heading3').click(function () {
221 this.element.find('#to_heading3').click(function () {
215 IPython.notebook.to_heading(undefined, 3);
222 IPython.notebook.to_heading(undefined, 3);
216 });
223 });
217 this.element.find('#to_heading4').click(function () {
224 this.element.find('#to_heading4').click(function () {
218 IPython.notebook.to_heading(undefined, 4);
225 IPython.notebook.to_heading(undefined, 4);
219 });
226 });
220 this.element.find('#to_heading5').click(function () {
227 this.element.find('#to_heading5').click(function () {
221 IPython.notebook.to_heading(undefined, 5);
228 IPython.notebook.to_heading(undefined, 5);
222 });
229 });
223 this.element.find('#to_heading6').click(function () {
230 this.element.find('#to_heading6').click(function () {
224 IPython.notebook.to_heading(undefined, 6);
231 IPython.notebook.to_heading(undefined, 6);
225 });
232 });
226 this.element.find('#toggle_output').click(function () {
233 this.element.find('#toggle_output').click(function () {
227 IPython.notebook.toggle_output();
234 IPython.notebook.toggle_output();
228 });
235 });
229 this.element.find('#collapse_all_output').click(function () {
236 this.element.find('#collapse_all_output').click(function () {
230 IPython.notebook.collapse_all_output();
237 IPython.notebook.collapse_all_output();
231 });
238 });
232 this.element.find('#scroll_all_output').click(function () {
239 this.element.find('#scroll_all_output').click(function () {
233 IPython.notebook.scroll_all_output();
240 IPython.notebook.scroll_all_output();
234 });
241 });
235 this.element.find('#expand_all_output').click(function () {
242 this.element.find('#expand_all_output').click(function () {
236 IPython.notebook.expand_all_output();
243 IPython.notebook.expand_all_output();
237 });
244 });
238 this.element.find('#clear_all_output').click(function () {
245 this.element.find('#clear_all_output').click(function () {
239 IPython.notebook.clear_all_output();
246 IPython.notebook.clear_all_output();
240 });
247 });
241 // Kernel
248 // Kernel
242 this.element.find('#int_kernel').click(function () {
249 this.element.find('#int_kernel').click(function () {
243 IPython.notebook.session.interrupt_kernel();
250 IPython.notebook.session.interrupt_kernel();
244 });
251 });
245 this.element.find('#restart_kernel').click(function () {
252 this.element.find('#restart_kernel').click(function () {
246 IPython.notebook.restart_kernel();
253 IPython.notebook.restart_kernel();
247 });
254 });
248 // Help
255 // Help
249 this.element.find('#keyboard_shortcuts').click(function () {
256 this.element.find('#keyboard_shortcuts').click(function () {
250 IPython.quick_help.show_keyboard_shortcuts();
257 IPython.quick_help.show_keyboard_shortcuts();
251 });
258 });
252
259
253 this.update_restore_checkpoint(null);
260 this.update_restore_checkpoint(null);
254
261
255 $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
262 $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
256 that.update_restore_checkpoint(IPython.notebook.checkpoints);
263 that.update_restore_checkpoint(IPython.notebook.checkpoints);
257 });
264 });
258
265
259 $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
266 $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
260 that.update_restore_checkpoint(IPython.notebook.checkpoints);
267 that.update_restore_checkpoint(IPython.notebook.checkpoints);
261 });
268 });
262 };
269 };
263
270
264 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
271 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
265 var ul = this.element.find("#restore_checkpoint").find("ul");
272 var ul = this.element.find("#restore_checkpoint").find("ul");
266 ul.empty();
273 ul.empty();
267 if (!checkpoints || checkpoints.length === 0) {
274 if (!checkpoints || checkpoints.length === 0) {
268 ul.append(
275 ul.append(
269 $("<li/>")
276 $("<li/>")
270 .addClass("disabled")
277 .addClass("disabled")
271 .append(
278 .append(
272 $("<a/>")
279 $("<a/>")
273 .text("No checkpoints")
280 .text("No checkpoints")
274 )
281 )
275 );
282 );
276 return;
283 return;
277 }
284 }
278
285
279 checkpoints.map(function (checkpoint) {
286 checkpoints.map(function (checkpoint) {
280 var d = new Date(checkpoint.last_modified);
287 var d = new Date(checkpoint.last_modified);
281 ul.append(
288 ul.append(
282 $("<li/>").append(
289 $("<li/>").append(
283 $("<a/>")
290 $("<a/>")
284 .attr("href", "#")
291 .attr("href", "#")
285 .text(d.format("mmm dd HH:MM:ss"))
292 .text(d.format("mmm dd HH:MM:ss"))
286 .click(function () {
293 .click(function () {
287 IPython.notebook.restore_checkpoint_dialog(checkpoint);
294 IPython.notebook.restore_checkpoint_dialog(checkpoint);
288 })
295 })
289 )
296 )
290 );
297 );
291 });
298 });
292 };
299 };
293
300
294 IPython.MenuBar = MenuBar;
301 IPython.MenuBar = MenuBar;
295
302
296 return IPython;
303 return IPython;
297
304
298 }(IPython));
305 }(IPython));
@@ -1,263 +1,263 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/codemirror/lib/codemirror.css") }}">
14 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15
15
16 {{super()}}
16 {{super()}}
17
17
18 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
18 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
19
19
20 {% endblock %}
20 {% endblock %}
21
21
22 {% block params %}
22 {% block params %}
23
23
24 data-project="{{project}}"
24 data-project="{{project}}"
25 data-base-project-url="{{base_project_url}}"
25 data-base-project-url="{{base_project_url}}"
26 data-base-kernel-url="{{base_kernel_url}}"
26 data-base-kernel-url="{{base_kernel_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 class="dropdown-menu">
54 <ul class="dropdown-menu">
55 <li id="new_notebook"><a href="#">New</a></li>
55 <li id="new_notebook"><a href="#">New</a></li>
56 <li id="open_notebook"><a href="#">Open...</a></li>
56 <li id="open_notebook"><a href="#">Open...</a></li>
57 <!-- <hr/> -->
57 <!-- <hr/> -->
58 <li class="divider"></li>
58 <li class="divider"></li>
59 <li id="copy_notebook"><a href="#">Make a Copy...</a></li>
59 <li id="copy_notebook"><a href="#">Make a Copy...</a></li>
60 <li id="rename_notebook"><a href="#">Rename...</a></li>
60 <li id="rename_notebook"><a href="#">Rename...</a></li>
61 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
61 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
62 <!-- <hr/> -->
62 <!-- <hr/> -->
63 <li class="divider"></li>
63 <li class="divider"></li>
64 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
64 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
65 <ul class="dropdown-menu">
65 <ul class="dropdown-menu">
66 <li><a href="#"></a></li>
66 <li><a href="#"></a></li>
67 <li><a href="#"></a></li>
67 <li><a href="#"></a></li>
68 <li><a href="#"></a></li>
68 <li><a href="#"></a></li>
69 <li><a href="#"></a></li>
69 <li><a href="#"></a></li>
70 <li><a href="#"></a></li>
70 <li><a href="#"></a></li>
71 </ul>
71 </ul>
72 </li>
72 </li>
73 <li class="divider"></li>
73 <li class="divider"></li>
74 <li class="dropdown-submenu"><a href="#">Download as</a>
74 <li class="dropdown-submenu"><a href="#">Download as</a>
75 <ul class="dropdown-menu">
75 <ul class="dropdown-menu">
76 <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li>
76 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
77 <li id="download_py"><a href="#">Python (.py)</a></li>
77 <!-- <li id="download_py"><a href="#">Python (.py)</a></li> -->
78 </ul>
78 </ul>
79 </li>
79 </li>
80 <li class="divider"></li>
80 <li class="divider"></li>
81
81
82 <li id="kill_and_exit"><a href="#" >Close and halt</a></li>
82 <li id="kill_and_exit"><a href="#" >Close and halt</a></li>
83 </ul>
83 </ul>
84 </li>
84 </li>
85 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
85 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
86 <ul class="dropdown-menu">
86 <ul class="dropdown-menu">
87 <li id="cut_cell"><a href="#">Cut Cell</a></li>
87 <li id="cut_cell"><a href="#">Cut Cell</a></li>
88 <li id="copy_cell"><a href="#">Copy Cell</a></li>
88 <li id="copy_cell"><a href="#">Copy Cell</a></li>
89 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
89 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
90 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
90 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
91 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
91 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
92 <li id="delete_cell"><a href="#">Delete Cell</a></li>
92 <li id="delete_cell"><a href="#">Delete Cell</a></li>
93 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
93 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
94 <li class="divider"></li>
94 <li class="divider"></li>
95 <li id="split_cell"><a href="#">Split Cell</a></li>
95 <li id="split_cell"><a href="#">Split Cell</a></li>
96 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
96 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
97 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
97 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
98 <li class="divider"></li>
98 <li class="divider"></li>
99 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
99 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
100 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
100 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
101 <li class="divider"></li>
101 <li class="divider"></li>
102 <li id="select_previous"><a href="#">Select Previous Cell</a></li>
102 <li id="select_previous"><a href="#">Select Previous Cell</a></li>
103 <li id="select_next"><a href="#">Select Next Cell</a></li>
103 <li id="select_next"><a href="#">Select Next Cell</a></li>
104 <li class="divider"></li>
104 <li class="divider"></li>
105 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
105 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
106 </ul>
106 </ul>
107 </li>
107 </li>
108 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
108 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
109 <ul class="dropdown-menu">
109 <ul class="dropdown-menu">
110 <li id="toggle_header"><a href="#">Toggle Header</a></li>
110 <li id="toggle_header"><a href="#">Toggle Header</a></li>
111 <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li>
111 <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li>
112 </ul>
112 </ul>
113 </li>
113 </li>
114 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
114 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
115 <ul class="dropdown-menu">
115 <ul class="dropdown-menu">
116 <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li>
116 <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li>
117 <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li>
117 <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li>
118 </ul>
118 </ul>
119 </li>
119 </li>
120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
121 <ul class="dropdown-menu">
121 <ul class="dropdown-menu">
122 <li id="run_cell"><a href="#">Run</a></li>
122 <li id="run_cell"><a href="#">Run</a></li>
123 <li id="run_cell_in_place"><a href="#">Run in Place</a></li>
123 <li id="run_cell_in_place"><a href="#">Run in Place</a></li>
124 <li id="run_all_cells"><a href="#">Run All</a></li>
124 <li id="run_all_cells"><a href="#">Run All</a></li>
125 <li id="run_all_cells_above"><a href="#">Run All Above</a></li>
125 <li id="run_all_cells_above"><a href="#">Run All Above</a></li>
126 <li id="run_all_cells_below"><a href="#">Run All Below</a></li>
126 <li id="run_all_cells_below"><a href="#">Run All Below</a></li>
127 <li class="divider"></li>
127 <li class="divider"></li>
128 <li id="change_cell_type" class="dropdown-submenu"><a href="#">Cell Type</a>
128 <li id="change_cell_type" class="dropdown-submenu"><a href="#">Cell Type</a>
129 <ul class="dropdown-menu">
129 <ul class="dropdown-menu">
130 <li id="to_code"><a href="#">Code</a></li>
130 <li id="to_code"><a href="#">Code</a></li>
131 <li id="to_markdown"><a href="#">Markdown </a></li>
131 <li id="to_markdown"><a href="#">Markdown </a></li>
132 <li id="to_raw"><a href="#">Raw Text</a></li>
132 <li id="to_raw"><a href="#">Raw Text</a></li>
133 <li id="to_heading1"><a href="#">Heading 1</a></li>
133 <li id="to_heading1"><a href="#">Heading 1</a></li>
134 <li id="to_heading2"><a href="#">Heading 2</a></li>
134 <li id="to_heading2"><a href="#">Heading 2</a></li>
135 <li id="to_heading3"><a href="#">Heading 3</a></li>
135 <li id="to_heading3"><a href="#">Heading 3</a></li>
136 <li id="to_heading4"><a href="#">Heading 4</a></li>
136 <li id="to_heading4"><a href="#">Heading 4</a></li>
137 <li id="to_heading5"><a href="#">Heading 5</a></li>
137 <li id="to_heading5"><a href="#">Heading 5</a></li>
138 <li id="to_heading6"><a href="#">Heading 6</a></li>
138 <li id="to_heading6"><a href="#">Heading 6</a></li>
139 </ul>
139 </ul>
140 </li>
140 </li>
141 <li class="divider"></li>
141 <li class="divider"></li>
142 <li id="toggle_output"><a href="#">Toggle Current Output</a></li>
142 <li id="toggle_output"><a href="#">Toggle Current Output</a></li>
143 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
143 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
144 <ul class="dropdown-menu">
144 <ul class="dropdown-menu">
145 <li id="expand_all_output"><a href="#">Expand</a></li>
145 <li id="expand_all_output"><a href="#">Expand</a></li>
146 <li id="scroll_all_output"><a href="#">Scroll Long</a></li>
146 <li id="scroll_all_output"><a href="#">Scroll Long</a></li>
147 <li id="collapse_all_output"><a href="#">Collapse</a></li>
147 <li id="collapse_all_output"><a href="#">Collapse</a></li>
148 <li id="clear_all_output"><a href="#">Clear</a></li>
148 <li id="clear_all_output"><a href="#">Clear</a></li>
149 </ul>
149 </ul>
150 </li>
150 </li>
151 </ul>
151 </ul>
152 </li>
152 </li>
153 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
153 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
154 <ul class="dropdown-menu">
154 <ul class="dropdown-menu">
155 <li id="int_kernel"><a href="#">Interrupt</a></li>
155 <li id="int_kernel"><a href="#">Interrupt</a></li>
156 <li id="restart_kernel"><a href="#">Restart</a></li>
156 <li id="restart_kernel"><a href="#">Restart</a></li>
157 </ul>
157 </ul>
158 </li>
158 </li>
159 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
159 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
160 <ul class="dropdown-menu">
160 <ul class="dropdown-menu">
161 <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li>
161 <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li>
162 <li><a href="http://ipython.org/ipython-doc/stable/interactive/notebook.html" target="_blank">Notebook Help</a></li>
162 <li><a href="http://ipython.org/ipython-doc/stable/interactive/notebook.html" target="_blank">Notebook Help</a></li>
163 <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li>
163 <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li>
164 <li class="divider"></li>
164 <li class="divider"></li>
165 <li><a href="http://docs.python.org" target="_blank">Python</a></li>
165 <li><a href="http://docs.python.org" target="_blank">Python</a></li>
166 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li>
166 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li>
167 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li>
167 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li>
168 <li><a href="http://matplotlib.org/" target="_blank">Matplotlib</a></li>
168 <li><a href="http://matplotlib.org/" target="_blank">Matplotlib</a></li>
169 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li>
169 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li>
170 <li><a href="http://pandas.pydata.org/pandas-docs/stable/" target="_blank">pandas</a></li>
170 <li><a href="http://pandas.pydata.org/pandas-docs/stable/" target="_blank">pandas</a></li>
171 </ul>
171 </ul>
172 </li>
172 </li>
173 </ul>
173 </ul>
174 <div id="notification_area"></div>
174 <div id="notification_area"></div>
175 </div>
175 </div>
176 </div>
176 </div>
177 </div>
177 </div>
178 </div>
178 </div>
179 <div id="maintoolbar" class="navbar">
179 <div id="maintoolbar" class="navbar">
180 <div class="toolbar-inner navbar-inner navbar-nobg">
180 <div class="toolbar-inner navbar-inner navbar-nobg">
181 <div id="maintoolbar-container" class="container"></div>
181 <div id="maintoolbar-container" class="container"></div>
182 </div>
182 </div>
183 </div>
183 </div>
184 </div>
184 </div>
185
185
186 <div id="ipython-main-app">
186 <div id="ipython-main-app">
187
187
188 <div id="notebook_panel">
188 <div id="notebook_panel">
189 <div id="notebook"></div>
189 <div id="notebook"></div>
190 <div id="pager_splitter"></div>
190 <div id="pager_splitter"></div>
191 <div id="pager">
191 <div id="pager">
192 <div id='pager_button_area'>
192 <div id='pager_button_area'>
193 </div>
193 </div>
194 <div id="pager-container" class="container"></div>
194 <div id="pager-container" class="container"></div>
195 </div>
195 </div>
196 </div>
196 </div>
197
197
198 </div>
198 </div>
199 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
199 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
200
200
201
201
202 {% endblock %}
202 {% endblock %}
203
203
204
204
205 {% block script %}
205 {% block script %}
206
206
207 {{super()}}
207 {{super()}}
208
208
209 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
209 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
210 <script type="text/javascript">
210 <script type="text/javascript">
211 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js") }}";
211 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js") }}";
212 </script>
212 </script>
213 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
213 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
214 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
214 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
215 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
215 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
216 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
216 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
217 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
217 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
218 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
218 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
219 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
219 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
220 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
220 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
221 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
221 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
222 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
222 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
223 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
223 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
224 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
224 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
225 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
225 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
226 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
226 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
227
227
228 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
228 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
229
229
230 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
230 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
231
231
232 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
232 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
233 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
233 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
234 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
234 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
235 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
235 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
236 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
236 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
237 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
237 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
238 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
238 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
239 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
239 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
240 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
240 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
241 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
241 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
242 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
242 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
243 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
243 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
244 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
244 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
245 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
245 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
246 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
246 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
247 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
247 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
248 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
248 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
249 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
249 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
250 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
250 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
251 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
251 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
252 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
252 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
253 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
253 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
254 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
254 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
255 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
255 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
256 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
256 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
257
257
258 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
258 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
259
259
260 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
260 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
261 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
261 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
262
262
263 {% endblock %}
263 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now