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