Show More
@@ -1,414 +1,418 b'' | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
4 | define([ |
|
4 | define([ | |
5 | 'jquery', |
|
5 | 'jquery', | |
6 | 'base/js/namespace', |
|
6 | 'base/js/namespace', | |
7 | 'base/js/dialog', |
|
7 | 'base/js/dialog', | |
8 | 'base/js/utils', |
|
8 | 'base/js/utils', | |
9 | 'notebook/js/tour', |
|
9 | 'notebook/js/tour', | |
10 | 'bootstrap', |
|
10 | 'bootstrap', | |
11 | 'moment', |
|
11 | 'moment', | |
12 | ], function($, IPython, dialog, utils, tour, bootstrap, moment) { |
|
12 | ], function($, IPython, dialog, utils, tour, bootstrap, moment) { | |
13 | "use strict"; |
|
13 | "use strict"; | |
14 |
|
14 | |||
15 | var MenuBar = function (selector, options) { |
|
15 | var MenuBar = function (selector, options) { | |
16 | /** |
|
16 | /** | |
17 | * Constructor |
|
17 | * Constructor | |
18 | * |
|
18 | * | |
19 | * A MenuBar Class to generate the menubar of IPython notebook |
|
19 | * A MenuBar Class to generate the menubar of IPython notebook | |
20 | * |
|
20 | * | |
21 | * Parameters: |
|
21 | * Parameters: | |
22 | * selector: string |
|
22 | * selector: string | |
23 | * options: dictionary |
|
23 | * options: dictionary | |
24 | * Dictionary of keyword arguments. |
|
24 | * Dictionary of keyword arguments. | |
25 | * notebook: Notebook instance |
|
25 | * notebook: Notebook instance | |
26 | * contents: ContentManager instance |
|
26 | * contents: ContentManager instance | |
27 | * events: $(Events) instance |
|
27 | * events: $(Events) instance | |
28 | * save_widget: SaveWidget instance |
|
28 | * save_widget: SaveWidget instance | |
29 | * quick_help: QuickHelp instance |
|
29 | * quick_help: QuickHelp instance | |
30 | * base_url : string |
|
30 | * base_url : string | |
31 | * notebook_path : string |
|
31 | * notebook_path : string | |
32 | * notebook_name : string |
|
32 | * notebook_name : string | |
33 | */ |
|
33 | */ | |
34 | options = options || {}; |
|
34 | options = options || {}; | |
35 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
35 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); | |
36 | this.selector = selector; |
|
36 | this.selector = selector; | |
37 | this.notebook = options.notebook; |
|
37 | this.notebook = options.notebook; | |
38 | this.contents = options.contents; |
|
38 | this.contents = options.contents; | |
39 | this.events = options.events; |
|
39 | this.events = options.events; | |
40 | this.save_widget = options.save_widget; |
|
40 | this.save_widget = options.save_widget; | |
41 | this.quick_help = options.quick_help; |
|
41 | this.quick_help = options.quick_help; | |
42 |
|
42 | |||
43 | try { |
|
43 | try { | |
44 | this.tour = new tour.Tour(this.notebook, this.events); |
|
44 | this.tour = new tour.Tour(this.notebook, this.events); | |
45 | } catch (e) { |
|
45 | } catch (e) { | |
46 | this.tour = undefined; |
|
46 | this.tour = undefined; | |
47 | console.log("Failed to instantiate Notebook Tour", e); |
|
47 | console.log("Failed to instantiate Notebook Tour", e); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | if (this.selector !== undefined) { |
|
50 | if (this.selector !== undefined) { | |
51 | this.element = $(selector); |
|
51 | this.element = $(selector); | |
52 | this.style(); |
|
52 | this.style(); | |
53 | this.bind_events(); |
|
53 | this.bind_events(); | |
54 | } |
|
54 | } | |
55 | }; |
|
55 | }; | |
56 |
|
56 | |||
57 | // TODO: This has definitively nothing to do with style ... |
|
57 | // TODO: This has definitively nothing to do with style ... | |
58 | MenuBar.prototype.style = function () { |
|
58 | MenuBar.prototype.style = function () { | |
59 | var that = this; |
|
59 | var that = this; | |
60 | this.element.find("li").click(function (event, ui) { |
|
60 | this.element.find("li").click(function (event, ui) { | |
61 | // The selected cell loses focus when the menu is entered, so we |
|
61 | // The selected cell loses focus when the menu is entered, so we | |
62 | // re-select it upon selection. |
|
62 | // re-select it upon selection. | |
63 | var i = that.notebook.get_selected_index(); |
|
63 | var i = that.notebook.get_selected_index(); | |
64 | that.notebook.select(i); |
|
64 | that.notebook.select(i); | |
65 | } |
|
65 | } | |
66 | ); |
|
66 | ); | |
67 | }; |
|
67 | }; | |
68 |
|
68 | |||
69 | MenuBar.prototype._nbconvert = function (format, download) { |
|
69 | MenuBar.prototype._nbconvert = function (format, download) { | |
70 | download = download || false; |
|
70 | download = download || false; | |
71 | var notebook_path = this.notebook.notebook_path; |
|
71 | var notebook_path = this.notebook.notebook_path; | |
72 | var url = utils.url_join_encode( |
|
72 | var url = utils.url_join_encode( | |
73 | this.base_url, |
|
73 | this.base_url, | |
74 | 'nbconvert', |
|
74 | 'nbconvert', | |
75 | format, |
|
75 | format, | |
76 | notebook_path |
|
76 | notebook_path | |
77 | ) + "?download=" + download.toString(); |
|
77 | ) + "?download=" + download.toString(); | |
78 |
|
78 | |||
79 | var w = window.open(undefined, IPython._target); |
|
79 | var w = window.open(undefined, IPython._target); | |
80 | if (this.notebook.dirty) { |
|
80 | if (this.notebook.dirty) { | |
81 | this.notebook.save_notebook().then(function() { |
|
81 | this.notebook.save_notebook().then(function() { | |
82 | w.location = url; |
|
82 | w.location = url; | |
83 | }); |
|
83 | }); | |
84 | } else { |
|
84 | } else { | |
85 | w.location = url; |
|
85 | w.location = url; | |
86 | } |
|
86 | } | |
87 | }; |
|
87 | }; | |
88 |
|
88 | |||
89 | MenuBar.prototype._size_header = function() { |
|
89 | MenuBar.prototype._size_header = function() { | |
90 | /** |
|
90 | /** | |
91 | * Update header spacer size. |
|
91 | * Update header spacer size. | |
92 | */ |
|
92 | */ | |
93 | this.events.trigger('resize-header.Page'); |
|
93 | this.events.trigger('resize-header.Page'); | |
94 | }; |
|
94 | }; | |
95 |
|
95 | |||
96 | MenuBar.prototype.bind_events = function () { |
|
96 | MenuBar.prototype.bind_events = function () { | |
97 | /** |
|
97 | /** | |
98 | * File |
|
98 | * File | |
99 | */ |
|
99 | */ | |
100 | var that = this; |
|
100 | var that = this; | |
101 |
|
101 | |||
102 | this.element.find('#open_notebook').click(function () { |
|
102 | this.element.find('#open_notebook').click(function () { | |
103 | var parent = utils.url_path_split(that.notebook.notebook_path)[0]; |
|
103 | var parent = utils.url_path_split(that.notebook.notebook_path)[0]; | |
104 | window.open(utils.url_join_encode(that.base_url, 'tree', parent), IPython._target); |
|
104 | window.open(utils.url_join_encode(that.base_url, 'tree', parent), IPython._target); | |
105 | }); |
|
105 | }); | |
106 | this.element.find('#copy_notebook').click(function () { |
|
106 | this.element.find('#copy_notebook').click(function () { | |
107 | that.notebook.copy_notebook(); |
|
107 | that.notebook.copy_notebook(); | |
108 | return false; |
|
108 | return false; | |
109 | }); |
|
109 | }); | |
110 | this.element.find('#download_ipynb').click(function () { |
|
110 | this.element.find('#download_ipynb').click(function () { | |
111 | var base_url = that.notebook.base_url; |
|
111 | var base_url = that.notebook.base_url; | |
112 | var notebook_path = that.notebook.notebook_path; |
|
112 | var notebook_path = that.notebook.notebook_path; | |
113 | if (that.notebook.dirty) { |
|
113 | if (that.notebook.dirty) { | |
114 | that.notebook.save_notebook({async : false}); |
|
114 | that.notebook.save_notebook({async : false}); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | var url = utils.url_join_encode(base_url, 'files', notebook_path); |
|
117 | var url = utils.url_join_encode(base_url, 'files', notebook_path); | |
118 | window.open(url + '?download=1'); |
|
118 | window.open(url + '?download=1'); | |
119 | }); |
|
119 | }); | |
120 |
|
120 | |||
121 | this.element.find('#print_preview').click(function () { |
|
121 | this.element.find('#print_preview').click(function () { | |
122 | that._nbconvert('html', false); |
|
122 | that._nbconvert('html', false); | |
123 | }); |
|
123 | }); | |
124 |
|
124 | |||
125 | this.element.find('#download_html').click(function () { |
|
125 | this.element.find('#download_html').click(function () { | |
126 | that._nbconvert('html', true); |
|
126 | that._nbconvert('html', true); | |
127 | }); |
|
127 | }); | |
128 |
|
128 | |||
|
129 | this.element.find('#download_markdown').click(function () { | |||
|
130 | that._nbconvert('markdown', true); | |||
|
131 | }); | |||
|
132 | ||||
129 | this.element.find('#download_rst').click(function () { |
|
133 | this.element.find('#download_rst').click(function () { | |
130 | that._nbconvert('rst', true); |
|
134 | that._nbconvert('rst', true); | |
131 | }); |
|
135 | }); | |
132 |
|
136 | |||
133 | this.element.find('#download_pdf').click(function () { |
|
137 | this.element.find('#download_pdf').click(function () { | |
134 | that._nbconvert('pdf', true); |
|
138 | that._nbconvert('pdf', true); | |
135 | }); |
|
139 | }); | |
136 |
|
140 | |||
137 | this.element.find('#download_script').click(function () { |
|
141 | this.element.find('#download_script').click(function () { | |
138 | that._nbconvert('script', true); |
|
142 | that._nbconvert('script', true); | |
139 | }); |
|
143 | }); | |
140 |
|
144 | |||
141 | this.element.find('#rename_notebook').click(function () { |
|
145 | this.element.find('#rename_notebook').click(function () { | |
142 | that.save_widget.rename_notebook({notebook: that.notebook}); |
|
146 | that.save_widget.rename_notebook({notebook: that.notebook}); | |
143 | }); |
|
147 | }); | |
144 |
|
148 | |||
145 | this.element.find('#save_checkpoint').click(function () { |
|
149 | this.element.find('#save_checkpoint').click(function () { | |
146 | that.notebook.save_checkpoint(); |
|
150 | that.notebook.save_checkpoint(); | |
147 | }); |
|
151 | }); | |
148 |
|
152 | |||
149 | this.element.find('#restore_checkpoint').click(function () { |
|
153 | this.element.find('#restore_checkpoint').click(function () { | |
150 | }); |
|
154 | }); | |
151 |
|
155 | |||
152 | this.element.find('#trust_notebook').click(function () { |
|
156 | this.element.find('#trust_notebook').click(function () { | |
153 | that.notebook.trust_notebook(); |
|
157 | that.notebook.trust_notebook(); | |
154 | }); |
|
158 | }); | |
155 | this.events.on('trust_changed.Notebook', function (event, trusted) { |
|
159 | this.events.on('trust_changed.Notebook', function (event, trusted) { | |
156 | if (trusted) { |
|
160 | if (trusted) { | |
157 | that.element.find('#trust_notebook') |
|
161 | that.element.find('#trust_notebook') | |
158 | .addClass("disabled").off('click') |
|
162 | .addClass("disabled").off('click') | |
159 | .find("a").text("Trusted Notebook"); |
|
163 | .find("a").text("Trusted Notebook"); | |
160 | } else { |
|
164 | } else { | |
161 | that.element.find('#trust_notebook') |
|
165 | that.element.find('#trust_notebook') | |
162 | .removeClass("disabled").on('click', function () { |
|
166 | .removeClass("disabled").on('click', function () { | |
163 | that.notebook.trust_notebook(); |
|
167 | that.notebook.trust_notebook(); | |
164 | }) |
|
168 | }) | |
165 | .find("a").text("Trust Notebook"); |
|
169 | .find("a").text("Trust Notebook"); | |
166 | } |
|
170 | } | |
167 | }); |
|
171 | }); | |
168 |
|
172 | |||
169 | this.element.find('#kill_and_exit').click(function () { |
|
173 | this.element.find('#kill_and_exit').click(function () { | |
170 | var close_window = function () { |
|
174 | var close_window = function () { | |
171 | /** |
|
175 | /** | |
172 | * allow closing of new tabs in Chromium, impossible in FF |
|
176 | * allow closing of new tabs in Chromium, impossible in FF | |
173 | */ |
|
177 | */ | |
174 | window.open('', '_self', ''); |
|
178 | window.open('', '_self', ''); | |
175 | window.close(); |
|
179 | window.close(); | |
176 | }; |
|
180 | }; | |
177 | // finish with close on success or failure |
|
181 | // finish with close on success or failure | |
178 | that.notebook.session.delete(close_window, close_window); |
|
182 | that.notebook.session.delete(close_window, close_window); | |
179 | }); |
|
183 | }); | |
180 |
|
184 | |||
181 | // Edit |
|
185 | // Edit | |
182 | this.element.find('#cut_cell').click(function () { |
|
186 | this.element.find('#cut_cell').click(function () { | |
183 | that.notebook.cut_cell(); |
|
187 | that.notebook.cut_cell(); | |
184 | }); |
|
188 | }); | |
185 | this.element.find('#copy_cell').click(function () { |
|
189 | this.element.find('#copy_cell').click(function () { | |
186 | that.notebook.copy_cell(); |
|
190 | that.notebook.copy_cell(); | |
187 | }); |
|
191 | }); | |
188 | this.element.find('#delete_cell').click(function () { |
|
192 | this.element.find('#delete_cell').click(function () { | |
189 | that.notebook.delete_cell(); |
|
193 | that.notebook.delete_cell(); | |
190 | }); |
|
194 | }); | |
191 | this.element.find('#undelete_cell').click(function () { |
|
195 | this.element.find('#undelete_cell').click(function () { | |
192 | that.notebook.undelete_cell(); |
|
196 | that.notebook.undelete_cell(); | |
193 | }); |
|
197 | }); | |
194 | this.element.find('#split_cell').click(function () { |
|
198 | this.element.find('#split_cell').click(function () { | |
195 | that.notebook.split_cell(); |
|
199 | that.notebook.split_cell(); | |
196 | }); |
|
200 | }); | |
197 | this.element.find('#merge_cell_above').click(function () { |
|
201 | this.element.find('#merge_cell_above').click(function () { | |
198 | that.notebook.merge_cell_above(); |
|
202 | that.notebook.merge_cell_above(); | |
199 | }); |
|
203 | }); | |
200 | this.element.find('#merge_cell_below').click(function () { |
|
204 | this.element.find('#merge_cell_below').click(function () { | |
201 | that.notebook.merge_cell_below(); |
|
205 | that.notebook.merge_cell_below(); | |
202 | }); |
|
206 | }); | |
203 | this.element.find('#move_cell_up').click(function () { |
|
207 | this.element.find('#move_cell_up').click(function () { | |
204 | that.notebook.move_cell_up(); |
|
208 | that.notebook.move_cell_up(); | |
205 | }); |
|
209 | }); | |
206 | this.element.find('#move_cell_down').click(function () { |
|
210 | this.element.find('#move_cell_down').click(function () { | |
207 | that.notebook.move_cell_down(); |
|
211 | that.notebook.move_cell_down(); | |
208 | }); |
|
212 | }); | |
209 | this.element.find('#edit_nb_metadata').click(function () { |
|
213 | this.element.find('#edit_nb_metadata').click(function () { | |
210 | that.notebook.edit_metadata({ |
|
214 | that.notebook.edit_metadata({ | |
211 | notebook: that.notebook, |
|
215 | notebook: that.notebook, | |
212 | keyboard_manager: that.notebook.keyboard_manager}); |
|
216 | keyboard_manager: that.notebook.keyboard_manager}); | |
213 | }); |
|
217 | }); | |
214 |
|
218 | |||
215 | // View |
|
219 | // View | |
216 | this.element.find('#toggle_header').click(function () { |
|
220 | this.element.find('#toggle_header').click(function () { | |
217 | $('#header-container').toggle(); |
|
221 | $('#header-container').toggle(); | |
218 | $('.header-bar').toggle(); |
|
222 | $('.header-bar').toggle(); | |
219 | that._size_header(); |
|
223 | that._size_header(); | |
220 | }); |
|
224 | }); | |
221 | this.element.find('#toggle_toolbar').click(function () { |
|
225 | this.element.find('#toggle_toolbar').click(function () { | |
222 | $('div#maintoolbar').toggle(); |
|
226 | $('div#maintoolbar').toggle(); | |
223 | that._size_header(); |
|
227 | that._size_header(); | |
224 | }); |
|
228 | }); | |
225 | // Insert |
|
229 | // Insert | |
226 | this.element.find('#insert_cell_above').click(function () { |
|
230 | this.element.find('#insert_cell_above').click(function () { | |
227 | that.notebook.insert_cell_above('code'); |
|
231 | that.notebook.insert_cell_above('code'); | |
228 | that.notebook.select_prev(); |
|
232 | that.notebook.select_prev(); | |
229 | }); |
|
233 | }); | |
230 | this.element.find('#insert_cell_below').click(function () { |
|
234 | this.element.find('#insert_cell_below').click(function () { | |
231 | that.notebook.insert_cell_below('code'); |
|
235 | that.notebook.insert_cell_below('code'); | |
232 | that.notebook.select_next(); |
|
236 | that.notebook.select_next(); | |
233 | }); |
|
237 | }); | |
234 | // Cell |
|
238 | // Cell | |
235 | this.element.find('#run_cell').click(function () { |
|
239 | this.element.find('#run_cell').click(function () { | |
236 | that.notebook.execute_cell(); |
|
240 | that.notebook.execute_cell(); | |
237 | }); |
|
241 | }); | |
238 | this.element.find('#run_cell_select_below').click(function () { |
|
242 | this.element.find('#run_cell_select_below').click(function () { | |
239 | that.notebook.execute_cell_and_select_below(); |
|
243 | that.notebook.execute_cell_and_select_below(); | |
240 | }); |
|
244 | }); | |
241 | this.element.find('#run_cell_insert_below').click(function () { |
|
245 | this.element.find('#run_cell_insert_below').click(function () { | |
242 | that.notebook.execute_cell_and_insert_below(); |
|
246 | that.notebook.execute_cell_and_insert_below(); | |
243 | }); |
|
247 | }); | |
244 | this.element.find('#run_all_cells').click(function () { |
|
248 | this.element.find('#run_all_cells').click(function () { | |
245 | that.notebook.execute_all_cells(); |
|
249 | that.notebook.execute_all_cells(); | |
246 | }); |
|
250 | }); | |
247 | this.element.find('#run_all_cells_above').click(function () { |
|
251 | this.element.find('#run_all_cells_above').click(function () { | |
248 | that.notebook.execute_cells_above(); |
|
252 | that.notebook.execute_cells_above(); | |
249 | }); |
|
253 | }); | |
250 | this.element.find('#run_all_cells_below').click(function () { |
|
254 | this.element.find('#run_all_cells_below').click(function () { | |
251 | that.notebook.execute_cells_below(); |
|
255 | that.notebook.execute_cells_below(); | |
252 | }); |
|
256 | }); | |
253 | this.element.find('#to_code').click(function () { |
|
257 | this.element.find('#to_code').click(function () { | |
254 | that.notebook.to_code(); |
|
258 | that.notebook.to_code(); | |
255 | }); |
|
259 | }); | |
256 | this.element.find('#to_markdown').click(function () { |
|
260 | this.element.find('#to_markdown').click(function () { | |
257 | that.notebook.to_markdown(); |
|
261 | that.notebook.to_markdown(); | |
258 | }); |
|
262 | }); | |
259 | this.element.find('#to_raw').click(function () { |
|
263 | this.element.find('#to_raw').click(function () { | |
260 | that.notebook.to_raw(); |
|
264 | that.notebook.to_raw(); | |
261 | }); |
|
265 | }); | |
262 |
|
266 | |||
263 | this.element.find('#toggle_current_output').click(function () { |
|
267 | this.element.find('#toggle_current_output').click(function () { | |
264 | that.notebook.toggle_output(); |
|
268 | that.notebook.toggle_output(); | |
265 | }); |
|
269 | }); | |
266 | this.element.find('#toggle_current_output_scroll').click(function () { |
|
270 | this.element.find('#toggle_current_output_scroll').click(function () { | |
267 | that.notebook.toggle_output_scroll(); |
|
271 | that.notebook.toggle_output_scroll(); | |
268 | }); |
|
272 | }); | |
269 | this.element.find('#clear_current_output').click(function () { |
|
273 | this.element.find('#clear_current_output').click(function () { | |
270 | that.notebook.clear_output(); |
|
274 | that.notebook.clear_output(); | |
271 | }); |
|
275 | }); | |
272 |
|
276 | |||
273 | this.element.find('#toggle_all_output').click(function () { |
|
277 | this.element.find('#toggle_all_output').click(function () { | |
274 | that.notebook.toggle_all_output(); |
|
278 | that.notebook.toggle_all_output(); | |
275 | }); |
|
279 | }); | |
276 | this.element.find('#toggle_all_output_scroll').click(function () { |
|
280 | this.element.find('#toggle_all_output_scroll').click(function () { | |
277 | that.notebook.toggle_all_output_scroll(); |
|
281 | that.notebook.toggle_all_output_scroll(); | |
278 | }); |
|
282 | }); | |
279 | this.element.find('#clear_all_output').click(function () { |
|
283 | this.element.find('#clear_all_output').click(function () { | |
280 | that.notebook.clear_all_output(); |
|
284 | that.notebook.clear_all_output(); | |
281 | }); |
|
285 | }); | |
282 |
|
286 | |||
283 | // Kernel |
|
287 | // Kernel | |
284 | this.element.find('#int_kernel').click(function () { |
|
288 | this.element.find('#int_kernel').click(function () { | |
285 | that.notebook.kernel.interrupt(); |
|
289 | that.notebook.kernel.interrupt(); | |
286 | }); |
|
290 | }); | |
287 | this.element.find('#restart_kernel').click(function () { |
|
291 | this.element.find('#restart_kernel').click(function () { | |
288 | that.notebook.restart_kernel(); |
|
292 | that.notebook.restart_kernel(); | |
289 | }); |
|
293 | }); | |
290 | this.element.find('#reconnect_kernel').click(function () { |
|
294 | this.element.find('#reconnect_kernel').click(function () { | |
291 | that.notebook.kernel.reconnect(); |
|
295 | that.notebook.kernel.reconnect(); | |
292 | }); |
|
296 | }); | |
293 | // Help |
|
297 | // Help | |
294 | if (this.tour) { |
|
298 | if (this.tour) { | |
295 | this.element.find('#notebook_tour').click(function () { |
|
299 | this.element.find('#notebook_tour').click(function () { | |
296 | that.tour.start(); |
|
300 | that.tour.start(); | |
297 | }); |
|
301 | }); | |
298 | } else { |
|
302 | } else { | |
299 | this.element.find('#notebook_tour').addClass("disabled"); |
|
303 | this.element.find('#notebook_tour').addClass("disabled"); | |
300 | } |
|
304 | } | |
301 | this.element.find('#keyboard_shortcuts').click(function () { |
|
305 | this.element.find('#keyboard_shortcuts').click(function () { | |
302 | that.quick_help.show_keyboard_shortcuts(); |
|
306 | that.quick_help.show_keyboard_shortcuts(); | |
303 | }); |
|
307 | }); | |
304 |
|
308 | |||
305 | this.update_restore_checkpoint(null); |
|
309 | this.update_restore_checkpoint(null); | |
306 |
|
310 | |||
307 | this.events.on('checkpoints_listed.Notebook', function (event, data) { |
|
311 | this.events.on('checkpoints_listed.Notebook', function (event, data) { | |
308 | that.update_restore_checkpoint(that.notebook.checkpoints); |
|
312 | that.update_restore_checkpoint(that.notebook.checkpoints); | |
309 | }); |
|
313 | }); | |
310 |
|
314 | |||
311 | this.events.on('checkpoint_created.Notebook', function (event, data) { |
|
315 | this.events.on('checkpoint_created.Notebook', function (event, data) { | |
312 | that.update_restore_checkpoint(that.notebook.checkpoints); |
|
316 | that.update_restore_checkpoint(that.notebook.checkpoints); | |
313 | }); |
|
317 | }); | |
314 |
|
318 | |||
315 | this.events.on('notebook_loaded.Notebook', function() { |
|
319 | this.events.on('notebook_loaded.Notebook', function() { | |
316 | var langinfo = that.notebook.metadata.language_info || {}; |
|
320 | var langinfo = that.notebook.metadata.language_info || {}; | |
317 | that.update_nbconvert_script(langinfo); |
|
321 | that.update_nbconvert_script(langinfo); | |
318 | }); |
|
322 | }); | |
319 |
|
323 | |||
320 | this.events.on('kernel_ready.Kernel', function(event, data) { |
|
324 | this.events.on('kernel_ready.Kernel', function(event, data) { | |
321 | var langinfo = data.kernel.info_reply.language_info || {}; |
|
325 | var langinfo = data.kernel.info_reply.language_info || {}; | |
322 | that.update_nbconvert_script(langinfo); |
|
326 | that.update_nbconvert_script(langinfo); | |
323 | that.add_kernel_help_links(data.kernel.info_reply.help_links || []); |
|
327 | that.add_kernel_help_links(data.kernel.info_reply.help_links || []); | |
324 | }); |
|
328 | }); | |
325 | }; |
|
329 | }; | |
326 |
|
330 | |||
327 | MenuBar.prototype.update_restore_checkpoint = function(checkpoints) { |
|
331 | MenuBar.prototype.update_restore_checkpoint = function(checkpoints) { | |
328 | var ul = this.element.find("#restore_checkpoint").find("ul"); |
|
332 | var ul = this.element.find("#restore_checkpoint").find("ul"); | |
329 | ul.empty(); |
|
333 | ul.empty(); | |
330 | if (!checkpoints || checkpoints.length === 0) { |
|
334 | if (!checkpoints || checkpoints.length === 0) { | |
331 | ul.append( |
|
335 | ul.append( | |
332 | $("<li/>") |
|
336 | $("<li/>") | |
333 | .addClass("disabled") |
|
337 | .addClass("disabled") | |
334 | .append( |
|
338 | .append( | |
335 | $("<a/>") |
|
339 | $("<a/>") | |
336 | .text("No checkpoints") |
|
340 | .text("No checkpoints") | |
337 | ) |
|
341 | ) | |
338 | ); |
|
342 | ); | |
339 | return; |
|
343 | return; | |
340 | } |
|
344 | } | |
341 |
|
345 | |||
342 | var that = this; |
|
346 | var that = this; | |
343 | checkpoints.map(function (checkpoint) { |
|
347 | checkpoints.map(function (checkpoint) { | |
344 | var d = new Date(checkpoint.last_modified); |
|
348 | var d = new Date(checkpoint.last_modified); | |
345 | ul.append( |
|
349 | ul.append( | |
346 | $("<li/>").append( |
|
350 | $("<li/>").append( | |
347 | $("<a/>") |
|
351 | $("<a/>") | |
348 | .attr("href", "#") |
|
352 | .attr("href", "#") | |
349 | .text(moment(d).format("LLLL")) |
|
353 | .text(moment(d).format("LLLL")) | |
350 | .click(function () { |
|
354 | .click(function () { | |
351 | that.notebook.restore_checkpoint_dialog(checkpoint); |
|
355 | that.notebook.restore_checkpoint_dialog(checkpoint); | |
352 | }) |
|
356 | }) | |
353 | ) |
|
357 | ) | |
354 | ); |
|
358 | ); | |
355 | }); |
|
359 | }); | |
356 | }; |
|
360 | }; | |
357 |
|
361 | |||
358 | MenuBar.prototype.update_nbconvert_script = function(langinfo) { |
|
362 | MenuBar.prototype.update_nbconvert_script = function(langinfo) { | |
359 | /** |
|
363 | /** | |
360 | * Set the 'Download as foo' menu option for the relevant language. |
|
364 | * Set the 'Download as foo' menu option for the relevant language. | |
361 | */ |
|
365 | */ | |
362 | var el = this.element.find('#download_script'); |
|
366 | var el = this.element.find('#download_script'); | |
363 |
|
367 | |||
364 | // Set menu entry text to e.g. "Python (.py)" |
|
368 | // Set menu entry text to e.g. "Python (.py)" | |
365 | var langname = (langinfo.name || 'Script'); |
|
369 | var langname = (langinfo.name || 'Script'); | |
366 | langname = langname.charAt(0).toUpperCase()+langname.substr(1); // Capitalise |
|
370 | langname = langname.charAt(0).toUpperCase()+langname.substr(1); // Capitalise | |
367 | el.find('a').text(langname + ' ('+(langinfo.file_extension || 'txt')+')'); |
|
371 | el.find('a').text(langname + ' ('+(langinfo.file_extension || 'txt')+')'); | |
368 | }; |
|
372 | }; | |
369 |
|
373 | |||
370 | MenuBar.prototype.add_kernel_help_links = function(help_links) { |
|
374 | MenuBar.prototype.add_kernel_help_links = function(help_links) { | |
371 | /** add links from kernel_info to the help menu */ |
|
375 | /** add links from kernel_info to the help menu */ | |
372 | var divider = $("#kernel-help-links"); |
|
376 | var divider = $("#kernel-help-links"); | |
373 | if (divider.length === 0) { |
|
377 | if (divider.length === 0) { | |
374 | // insert kernel help section above about link |
|
378 | // insert kernel help section above about link | |
375 | var about = $("#notebook_about").parent(); |
|
379 | var about = $("#notebook_about").parent(); | |
376 | divider = $("<li>") |
|
380 | divider = $("<li>") | |
377 | .attr('id', "kernel-help-links") |
|
381 | .attr('id', "kernel-help-links") | |
378 | .addClass('divider'); |
|
382 | .addClass('divider'); | |
379 | about.prev().before(divider); |
|
383 | about.prev().before(divider); | |
380 | } |
|
384 | } | |
381 | // remove previous entries |
|
385 | // remove previous entries | |
382 | while (!divider.next().hasClass('divider')) { |
|
386 | while (!divider.next().hasClass('divider')) { | |
383 | divider.next().remove(); |
|
387 | divider.next().remove(); | |
384 | } |
|
388 | } | |
385 | if (help_links.length === 0) { |
|
389 | if (help_links.length === 0) { | |
386 | // no help links, remove the divider |
|
390 | // no help links, remove the divider | |
387 | divider.remove(); |
|
391 | divider.remove(); | |
388 | return; |
|
392 | return; | |
389 | } |
|
393 | } | |
390 | var cursor = divider; |
|
394 | var cursor = divider; | |
391 | help_links.map(function (link) { |
|
395 | help_links.map(function (link) { | |
392 | cursor.after($("<li>") |
|
396 | cursor.after($("<li>") | |
393 | .append($("<a>") |
|
397 | .append($("<a>") | |
394 | .attr('target', '_blank') |
|
398 | .attr('target', '_blank') | |
395 | .attr('title', 'Opens in a new window') |
|
399 | .attr('title', 'Opens in a new window') | |
396 | .attr('href', link.url) |
|
400 | .attr('href', link.url) | |
397 | .append($("<i>") |
|
401 | .append($("<i>") | |
398 | .addClass("fa fa-external-link menu-icon pull-right") |
|
402 | .addClass("fa fa-external-link menu-icon pull-right") | |
399 | ) |
|
403 | ) | |
400 | .append($("<span>") |
|
404 | .append($("<span>") | |
401 | .text(link.text) |
|
405 | .text(link.text) | |
402 | ) |
|
406 | ) | |
403 | ) |
|
407 | ) | |
404 | ); |
|
408 | ); | |
405 | cursor = cursor.next(); |
|
409 | cursor = cursor.next(); | |
406 | }); |
|
410 | }); | |
407 |
|
411 | |||
408 | }; |
|
412 | }; | |
409 |
|
413 | |||
410 | // Backwards compatability. |
|
414 | // Backwards compatability. | |
411 | IPython.MenuBar = MenuBar; |
|
415 | IPython.MenuBar = MenuBar; | |
412 |
|
416 | |||
413 | return {'MenuBar': MenuBar}; |
|
417 | return {'MenuBar': MenuBar}; | |
414 | }); |
|
418 | }); |
@@ -1,327 +1,328 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 | <link rel="stylesheet" href="" id='kernel-css' type="text/css" /> |
|
20 | <link rel="stylesheet" href="" id='kernel-css' type="text/css" /> | |
21 |
|
21 | |||
22 | {% endblock %} |
|
22 | {% endblock %} | |
23 |
|
23 | |||
24 | {% block bodyclasses %}notebook_app {{super()}}{% endblock %} |
|
24 | {% block bodyclasses %}notebook_app {{super()}}{% endblock %} | |
25 |
|
25 | |||
26 | {% block params %} |
|
26 | {% block params %} | |
27 |
|
27 | |||
28 | data-project="{{project}}" |
|
28 | data-project="{{project}}" | |
29 | data-base-url="{{base_url}}" |
|
29 | data-base-url="{{base_url}}" | |
30 | data-ws-url="{{ws_url}}" |
|
30 | data-ws-url="{{ws_url}}" | |
31 | data-notebook-name="{{notebook_name}}" |
|
31 | data-notebook-name="{{notebook_name}}" | |
32 | data-notebook-path="{{notebook_path}}" |
|
32 | data-notebook-path="{{notebook_path}}" | |
33 |
|
33 | |||
34 | {% endblock %} |
|
34 | {% endblock %} | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | {% block headercontainer %} |
|
37 | {% block headercontainer %} | |
38 |
|
38 | |||
39 |
|
39 | |||
40 | <span id="save_widget" class="pull-left save_widget"> |
|
40 | <span id="save_widget" class="pull-left save_widget"> | |
41 | <span id="notebook_name" class="filename"></span> |
|
41 | <span id="notebook_name" class="filename"></span> | |
42 | <span class="checkpoint_status"></span> |
|
42 | <span class="checkpoint_status"></span> | |
43 | <span class="autosave_status"></span> |
|
43 | <span class="autosave_status"></span> | |
44 | </span> |
|
44 | </span> | |
45 |
|
45 | |||
46 | <span id="kernel_logo_widget"> |
|
46 | <span id="kernel_logo_widget"> | |
47 | <img class="current_kernel_logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/> |
|
47 | <img class="current_kernel_logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/> | |
48 | </span> |
|
48 | </span> | |
49 |
|
49 | |||
50 | {% endblock headercontainer %} |
|
50 | {% endblock headercontainer %} | |
51 |
|
51 | |||
52 | {% block header %} |
|
52 | {% block header %} | |
53 | <div id="menubar-container" class="container"> |
|
53 | <div id="menubar-container" class="container"> | |
54 | <div id="menubar"> |
|
54 | <div id="menubar"> | |
55 | <div id="menus" class="navbar navbar-default" role="navigation"> |
|
55 | <div id="menus" class="navbar navbar-default" role="navigation"> | |
56 | <div class="container-fluid"> |
|
56 | <div class="container-fluid"> | |
57 | <button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> |
|
57 | <button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> | |
58 | <i class="fa fa-bars"></i> |
|
58 | <i class="fa fa-bars"></i> | |
59 | <span class="navbar-text">Menu</span> |
|
59 | <span class="navbar-text">Menu</span> | |
60 | </button> |
|
60 | </button> | |
61 | <p id="kernel_indicator" class="navbar-text indicator_area"> |
|
61 | <p id="kernel_indicator" class="navbar-text indicator_area"> | |
62 | <span class="kernel_indicator_name">Kernel</span> |
|
62 | <span class="kernel_indicator_name">Kernel</span> | |
63 | <i id="kernel_indicator_icon"></i> |
|
63 | <i id="kernel_indicator_icon"></i> | |
64 | </p> |
|
64 | </p> | |
65 | <i id="readonly-indicator" class="navbar-text" title='This notebook is read-only'> |
|
65 | <i id="readonly-indicator" class="navbar-text" title='This notebook is read-only'> | |
66 | <span class="fa-stack"> |
|
66 | <span class="fa-stack"> | |
67 | <i class="fa fa-save fa-stack-1x"></i> |
|
67 | <i class="fa fa-save fa-stack-1x"></i> | |
68 | <i class="fa fa-ban fa-stack-2x text-danger"></i> |
|
68 | <i class="fa fa-ban fa-stack-2x text-danger"></i> | |
69 | </span> |
|
69 | </span> | |
70 | </i> |
|
70 | </i> | |
71 | <i id="modal_indicator" class="navbar-text"></i> |
|
71 | <i id="modal_indicator" class="navbar-text"></i> | |
72 | <span id="notification_area"></span> |
|
72 | <span id="notification_area"></span> | |
73 | <div class="navbar-collapse collapse"> |
|
73 | <div class="navbar-collapse collapse"> | |
74 | <ul class="nav navbar-nav"> |
|
74 | <ul class="nav navbar-nav"> | |
75 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a> |
|
75 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a> | |
76 | <ul id="file_menu" class="dropdown-menu"> |
|
76 | <ul id="file_menu" class="dropdown-menu"> | |
77 | <li id="new_notebook" class="dropdown-submenu"> |
|
77 | <li id="new_notebook" class="dropdown-submenu"> | |
78 | <a href="#">New Notebook</a> |
|
78 | <a href="#">New Notebook</a> | |
79 | <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul> |
|
79 | <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul> | |
80 | </li> |
|
80 | </li> | |
81 | <li id="open_notebook" |
|
81 | <li id="open_notebook" | |
82 | title="Opens a new window with the Dashboard view"> |
|
82 | title="Opens a new window with the Dashboard view"> | |
83 | <a href="#">Open...</a></li> |
|
83 | <a href="#">Open...</a></li> | |
84 | <!-- <hr/> --> |
|
84 | <!-- <hr/> --> | |
85 | <li class="divider"></li> |
|
85 | <li class="divider"></li> | |
86 | <li id="copy_notebook" |
|
86 | <li id="copy_notebook" | |
87 | title="Open a copy of this notebook's contents and start a new kernel"> |
|
87 | title="Open a copy of this notebook's contents and start a new kernel"> | |
88 | <a href="#">Make a Copy...</a></li> |
|
88 | <a href="#">Make a Copy...</a></li> | |
89 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
89 | <li id="rename_notebook"><a href="#">Rename...</a></li> | |
90 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> |
|
90 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> | |
91 | <!-- <hr/> --> |
|
91 | <!-- <hr/> --> | |
92 | <li class="divider"></li> |
|
92 | <li class="divider"></li> | |
93 | <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a> |
|
93 | <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a> | |
94 | <ul class="dropdown-menu"> |
|
94 | <ul class="dropdown-menu"> | |
95 | <li><a href="#"></a></li> |
|
95 | <li><a href="#"></a></li> | |
96 | <li><a href="#"></a></li> |
|
96 | <li><a href="#"></a></li> | |
97 | <li><a href="#"></a></li> |
|
97 | <li><a href="#"></a></li> | |
98 | <li><a href="#"></a></li> |
|
98 | <li><a href="#"></a></li> | |
99 | <li><a href="#"></a></li> |
|
99 | <li><a href="#"></a></li> | |
100 | </ul> |
|
100 | </ul> | |
101 | </li> |
|
101 | </li> | |
102 | <li class="divider"></li> |
|
102 | <li class="divider"></li> | |
103 | <li id="print_preview"><a href="#">Print Preview</a></li> |
|
103 | <li id="print_preview"><a href="#">Print Preview</a></li> | |
104 | <li class="dropdown-submenu"><a href="#">Download as</a> |
|
104 | <li class="dropdown-submenu"><a href="#">Download as</a> | |
105 | <ul class="dropdown-menu"> |
|
105 | <ul class="dropdown-menu"> | |
106 | <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li> |
|
106 | <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li> | |
107 | <li id="download_script"><a href="#">Script</a></li> |
|
107 | <li id="download_script"><a href="#">Script</a></li> | |
108 | <li id="download_html"><a href="#">HTML (.html)</a></li> |
|
108 | <li id="download_html"><a href="#">HTML (.html)</a></li> | |
|
109 | <li id="download_markdown"><a href="#">Markdown (.md)</a></li> | |||
109 | <li id="download_rst"><a href="#">reST (.rst)</a></li> |
|
110 | <li id="download_rst"><a href="#">reST (.rst)</a></li> | |
110 | <li id="download_pdf"><a href="#">PDF (.pdf)</a></li> |
|
111 | <li id="download_pdf"><a href="#">PDF (.pdf)</a></li> | |
111 | </ul> |
|
112 | </ul> | |
112 | </li> |
|
113 | </li> | |
113 | <li class="divider"></li> |
|
114 | <li class="divider"></li> | |
114 | <li id="trust_notebook" |
|
115 | <li id="trust_notebook" | |
115 | title="Trust the output of this notebook"> |
|
116 | title="Trust the output of this notebook"> | |
116 | <a href="#" >Trust Notebook</a></li> |
|
117 | <a href="#" >Trust Notebook</a></li> | |
117 | <li class="divider"></li> |
|
118 | <li class="divider"></li> | |
118 | <li id="kill_and_exit" |
|
119 | <li id="kill_and_exit" | |
119 | title="Shutdown this notebook's kernel, and close this window"> |
|
120 | title="Shutdown this notebook's kernel, and close this window"> | |
120 | <a href="#" >Close and Halt</a></li> |
|
121 | <a href="#" >Close and Halt</a></li> | |
121 | </ul> |
|
122 | </ul> | |
122 | </li> |
|
123 | </li> | |
123 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
|
124 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> | |
124 | <ul id="edit_menu" class="dropdown-menu"> |
|
125 | <ul id="edit_menu" class="dropdown-menu"> | |
125 | <li id="cut_cell"><a href="#">Cut Cell</a></li> |
|
126 | <li id="cut_cell"><a href="#">Cut Cell</a></li> | |
126 | <li id="copy_cell"><a href="#">Copy Cell</a></li> |
|
127 | <li id="copy_cell"><a href="#">Copy Cell</a></li> | |
127 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> |
|
128 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> | |
128 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> |
|
129 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> | |
129 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> |
|
130 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> | |
130 | <li id="delete_cell"><a href="#">Delete Cell</a></li> |
|
131 | <li id="delete_cell"><a href="#">Delete Cell</a></li> | |
131 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> |
|
132 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> | |
132 | <li class="divider"></li> |
|
133 | <li class="divider"></li> | |
133 | <li id="split_cell"><a href="#">Split Cell</a></li> |
|
134 | <li id="split_cell"><a href="#">Split Cell</a></li> | |
134 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> |
|
135 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> | |
135 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> |
|
136 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> | |
136 | <li class="divider"></li> |
|
137 | <li class="divider"></li> | |
137 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> |
|
138 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> | |
138 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
139 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> | |
139 | <li class="divider"></li> |
|
140 | <li class="divider"></li> | |
140 | <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li> |
|
141 | <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li> | |
141 | </ul> |
|
142 | </ul> | |
142 | </li> |
|
143 | </li> | |
143 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> |
|
144 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> | |
144 | <ul id="view_menu" class="dropdown-menu"> |
|
145 | <ul id="view_menu" class="dropdown-menu"> | |
145 | <li id="toggle_header" |
|
146 | <li id="toggle_header" | |
146 | title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)"> |
|
147 | title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)"> | |
147 | <a href="#">Toggle Header</a></li> |
|
148 | <a href="#">Toggle Header</a></li> | |
148 | <li id="toggle_toolbar" |
|
149 | <li id="toggle_toolbar" | |
149 | title="Show/Hide the action icons (below menu bar)"> |
|
150 | title="Show/Hide the action icons (below menu bar)"> | |
150 | <a href="#">Toggle Toolbar</a></li> |
|
151 | <a href="#">Toggle Toolbar</a></li> | |
151 | </ul> |
|
152 | </ul> | |
152 | </li> |
|
153 | </li> | |
153 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> |
|
154 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> | |
154 | <ul id="insert_menu" class="dropdown-menu"> |
|
155 | <ul id="insert_menu" class="dropdown-menu"> | |
155 | <li id="insert_cell_above" |
|
156 | <li id="insert_cell_above" | |
156 | title="Insert an empty Code cell above the currently active cell"> |
|
157 | title="Insert an empty Code cell above the currently active cell"> | |
157 | <a href="#">Insert Cell Above</a></li> |
|
158 | <a href="#">Insert Cell Above</a></li> | |
158 | <li id="insert_cell_below" |
|
159 | <li id="insert_cell_below" | |
159 | title="Insert an empty Code cell below the currently active cell"> |
|
160 | title="Insert an empty Code cell below the currently active cell"> | |
160 | <a href="#">Insert Cell Below</a></li> |
|
161 | <a href="#">Insert Cell Below</a></li> | |
161 | </ul> |
|
162 | </ul> | |
162 | </li> |
|
163 | </li> | |
163 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> |
|
164 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> | |
164 | <ul id="cell_menu" class="dropdown-menu"> |
|
165 | <ul id="cell_menu" class="dropdown-menu"> | |
165 | <li id="run_cell" title="Run this cell, and move cursor to the next one"> |
|
166 | <li id="run_cell" title="Run this cell, and move cursor to the next one"> | |
166 | <a href="#">Run</a></li> |
|
167 | <a href="#">Run</a></li> | |
167 | <li id="run_cell_select_below" title="Run this cell, select below"> |
|
168 | <li id="run_cell_select_below" title="Run this cell, select below"> | |
168 | <a href="#">Run and Select Below</a></li> |
|
169 | <a href="#">Run and Select Below</a></li> | |
169 | <li id="run_cell_insert_below" title="Run this cell, insert below"> |
|
170 | <li id="run_cell_insert_below" title="Run this cell, insert below"> | |
170 | <a href="#">Run and Insert Below</a></li> |
|
171 | <a href="#">Run and Insert Below</a></li> | |
171 | <li id="run_all_cells" title="Run all cells in the notebook"> |
|
172 | <li id="run_all_cells" title="Run all cells in the notebook"> | |
172 | <a href="#">Run All</a></li> |
|
173 | <a href="#">Run All</a></li> | |
173 | <li id="run_all_cells_above" title="Run all cells above (but not including) this cell"> |
|
174 | <li id="run_all_cells_above" title="Run all cells above (but not including) this cell"> | |
174 | <a href="#">Run All Above</a></li> |
|
175 | <a href="#">Run All Above</a></li> | |
175 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> |
|
176 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> | |
176 | <a href="#">Run All Below</a></li> |
|
177 | <a href="#">Run All Below</a></li> | |
177 | <li class="divider"></li> |
|
178 | <li class="divider"></li> | |
178 | <li id="change_cell_type" class="dropdown-submenu" |
|
179 | <li id="change_cell_type" class="dropdown-submenu" | |
179 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> |
|
180 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> | |
180 | <a href="#">Cell Type</a> |
|
181 | <a href="#">Cell Type</a> | |
181 | <ul class="dropdown-menu"> |
|
182 | <ul class="dropdown-menu"> | |
182 | <li id="to_code" |
|
183 | <li id="to_code" | |
183 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> |
|
184 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> | |
184 | <a href="#">Code</a></li> |
|
185 | <a href="#">Code</a></li> | |
185 | <li id="to_markdown" |
|
186 | <li id="to_markdown" | |
186 | title="Contents will be rendered as HTML and serve as explanatory text"> |
|
187 | title="Contents will be rendered as HTML and serve as explanatory text"> | |
187 | <a href="#">Markdown</a></li> |
|
188 | <a href="#">Markdown</a></li> | |
188 | <li id="to_raw" |
|
189 | <li id="to_raw" | |
189 | title="Contents will pass through nbconvert unmodified"> |
|
190 | title="Contents will pass through nbconvert unmodified"> | |
190 | <a href="#">Raw NBConvert</a></li> |
|
191 | <a href="#">Raw NBConvert</a></li> | |
191 | </ul> |
|
192 | </ul> | |
192 | </li> |
|
193 | </li> | |
193 | <li class="divider"></li> |
|
194 | <li class="divider"></li> | |
194 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> |
|
195 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> | |
195 | <ul class="dropdown-menu"> |
|
196 | <ul class="dropdown-menu"> | |
196 | <li id="toggle_current_output" |
|
197 | <li id="toggle_current_output" | |
197 | title="Hide/Show the output of the current cell"> |
|
198 | title="Hide/Show the output of the current cell"> | |
198 | <a href="#">Toggle</a> |
|
199 | <a href="#">Toggle</a> | |
199 | </li> |
|
200 | </li> | |
200 | <li id="toggle_current_output_scroll" |
|
201 | <li id="toggle_current_output_scroll" | |
201 | title="Scroll the output of the current cell"> |
|
202 | title="Scroll the output of the current cell"> | |
202 | <a href="#">Toggle Scrolling</a> |
|
203 | <a href="#">Toggle Scrolling</a> | |
203 | </li> |
|
204 | </li> | |
204 | <li id="clear_current_output" |
|
205 | <li id="clear_current_output" | |
205 | title="Clear the output of the current cell"> |
|
206 | title="Clear the output of the current cell"> | |
206 | <a href="#">Clear</a> |
|
207 | <a href="#">Clear</a> | |
207 | </li> |
|
208 | </li> | |
208 | </ul> |
|
209 | </ul> | |
209 | </li> |
|
210 | </li> | |
210 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> |
|
211 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> | |
211 | <ul class="dropdown-menu"> |
|
212 | <ul class="dropdown-menu"> | |
212 | <li id="toggle_all_output" |
|
213 | <li id="toggle_all_output" | |
213 | title="Hide/Show the output of all cells"> |
|
214 | title="Hide/Show the output of all cells"> | |
214 | <a href="#">Toggle</a> |
|
215 | <a href="#">Toggle</a> | |
215 | </li> |
|
216 | </li> | |
216 | <li id="toggle_all_output_scroll" |
|
217 | <li id="toggle_all_output_scroll" | |
217 | title="Scroll the output of all cells"> |
|
218 | title="Scroll the output of all cells"> | |
218 | <a href="#">Toggle Scrolling</a> |
|
219 | <a href="#">Toggle Scrolling</a> | |
219 | </li> |
|
220 | </li> | |
220 | <li id="clear_all_output" |
|
221 | <li id="clear_all_output" | |
221 | title="Clear the output of all cells"> |
|
222 | title="Clear the output of all cells"> | |
222 | <a href="#">Clear</a> |
|
223 | <a href="#">Clear</a> | |
223 | </li> |
|
224 | </li> | |
224 | </ul> |
|
225 | </ul> | |
225 | </li> |
|
226 | </li> | |
226 | </ul> |
|
227 | </ul> | |
227 | </li> |
|
228 | </li> | |
228 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> |
|
229 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> | |
229 | <ul id="kernel_menu" class="dropdown-menu"> |
|
230 | <ul id="kernel_menu" class="dropdown-menu"> | |
230 | <li id="int_kernel" |
|
231 | <li id="int_kernel" | |
231 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> |
|
232 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> | |
232 | <a href="#">Interrupt</a> |
|
233 | <a href="#">Interrupt</a> | |
233 | </li> |
|
234 | </li> | |
234 | <li id="restart_kernel" |
|
235 | <li id="restart_kernel" | |
235 | title="Restart the Kernel"> |
|
236 | title="Restart the Kernel"> | |
236 | <a href="#">Restart</a> |
|
237 | <a href="#">Restart</a> | |
237 | </li> |
|
238 | </li> | |
238 | <li id="reconnect_kernel" |
|
239 | <li id="reconnect_kernel" | |
239 | title="Reconnect to the Kernel"> |
|
240 | title="Reconnect to the Kernel"> | |
240 | <a href="#">Reconnect</a> |
|
241 | <a href="#">Reconnect</a> | |
241 | </li> |
|
242 | </li> | |
242 | <li class="divider"></li> |
|
243 | <li class="divider"></li> | |
243 | <li id="menu-change-kernel" class="dropdown-submenu"> |
|
244 | <li id="menu-change-kernel" class="dropdown-submenu"> | |
244 | <a href="#">Change kernel</a> |
|
245 | <a href="#">Change kernel</a> | |
245 | <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul> |
|
246 | <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul> | |
246 | </li> |
|
247 | </li> | |
247 | </ul> |
|
248 | </ul> | |
248 | </li> |
|
249 | </li> | |
249 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> |
|
250 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> | |
250 | <ul id="help_menu" class="dropdown-menu"> |
|
251 | <ul id="help_menu" class="dropdown-menu"> | |
251 | <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li> |
|
252 | <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li> | |
252 | <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
253 | <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li> | |
253 | <li class="divider"></li> |
|
254 | <li class="divider"></li> | |
254 | {% set |
|
255 | {% set | |
255 | sections = ( |
|
256 | sections = ( | |
256 | ( |
|
257 | ( | |
257 | ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True), |
|
258 | ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True), | |
258 | ("https://help.github.com/articles/markdown-basics/","Markdown",True), |
|
259 | ("https://help.github.com/articles/markdown-basics/","Markdown",True), | |
259 | ), |
|
260 | ), | |
260 | ) |
|
261 | ) | |
261 | %} |
|
262 | %} | |
262 |
|
263 | |||
263 | {% for helplinks in sections %} |
|
264 | {% for helplinks in sections %} | |
264 | {% for link in helplinks %} |
|
265 | {% for link in helplinks %} | |
265 | <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}> |
|
266 | <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}> | |
266 | {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}} |
|
267 | {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}} | |
267 | {{link[1]}} |
|
268 | {{link[1]}} | |
268 | </a></li> |
|
269 | </a></li> | |
269 | {% endfor %} |
|
270 | {% endfor %} | |
270 | {% if not loop.last %} |
|
271 | {% if not loop.last %} | |
271 | <li class="divider"></li> |
|
272 | <li class="divider"></li> | |
272 | {% endif %} |
|
273 | {% endif %} | |
273 | {% endfor %} |
|
274 | {% endfor %} | |
274 | <li class="divider"></li> |
|
275 | <li class="divider"></li> | |
275 | <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li> |
|
276 | <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li> | |
276 | </ul> |
|
277 | </ul> | |
277 | </li> |
|
278 | </li> | |
278 | </ul> |
|
279 | </ul> | |
279 | </div> |
|
280 | </div> | |
280 | </div> |
|
281 | </div> | |
281 | </div> |
|
282 | </div> | |
282 | </div> |
|
283 | </div> | |
283 |
|
284 | |||
284 | <div id="maintoolbar" class="navbar"> |
|
285 | <div id="maintoolbar" class="navbar"> | |
285 | <div class="toolbar-inner navbar-inner navbar-nobg"> |
|
286 | <div class="toolbar-inner navbar-inner navbar-nobg"> | |
286 | <div id="maintoolbar-container" class="container"></div> |
|
287 | <div id="maintoolbar-container" class="container"></div> | |
287 | </div> |
|
288 | </div> | |
288 | </div> |
|
289 | </div> | |
289 | </div> |
|
290 | </div> | |
290 |
|
291 | |||
291 | <div class="lower-header-bar"></div> |
|
292 | <div class="lower-header-bar"></div> | |
292 | {% endblock header %} |
|
293 | {% endblock header %} | |
293 |
|
294 | |||
294 | {% block site %} |
|
295 | {% block site %} | |
295 |
|
296 | |||
296 | <div id="ipython-main-app"> |
|
297 | <div id="ipython-main-app"> | |
297 | <div id="notebook_panel"> |
|
298 | <div id="notebook_panel"> | |
298 | <div id="notebook"></div> |
|
299 | <div id="notebook"></div> | |
299 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> |
|
300 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> | |
300 | </div> |
|
301 | </div> | |
301 | </div> |
|
302 | </div> | |
302 |
|
303 | |||
303 |
|
304 | |||
304 | {% endblock %} |
|
305 | {% endblock %} | |
305 |
|
306 | |||
306 | {% block after_site %} |
|
307 | {% block after_site %} | |
307 |
|
308 | |||
308 | <div id="pager"> |
|
309 | <div id="pager"> | |
309 | <div id="pager-contents"> |
|
310 | <div id="pager-contents"> | |
310 | <div id="pager-container" class="container"></div> |
|
311 | <div id="pager-container" class="container"></div> | |
311 | </div> |
|
312 | </div> | |
312 | <div id='pager-button-area'></div> |
|
313 | <div id='pager-button-area'></div> | |
313 | </div> |
|
314 | </div> | |
314 |
|
315 | |||
315 | {% endblock %} |
|
316 | {% endblock %} | |
316 |
|
317 | |||
317 | {% block script %} |
|
318 | {% block script %} | |
318 | {{super()}} |
|
319 | {{super()}} | |
319 | <script type="text/javascript"> |
|
320 | <script type="text/javascript"> | |
320 | sys_info = {{sys_info}}; |
|
321 | sys_info = {{sys_info}}; | |
321 | </script> |
|
322 | </script> | |
322 |
|
323 | |||
323 | <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script> |
|
324 | <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script> | |
324 |
|
325 | |||
325 | <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script> |
|
326 | <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script> | |
326 |
|
327 | |||
327 | {% endblock %} |
|
328 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now