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