Show More
@@ -1,337 +1,347 b'' | |||||
1 | define([ |
|
1 | define([ | |
2 | 'base/js/namespace', |
|
2 | 'base/js/namespace', | |
3 | 'jquery', |
|
3 | 'jquery', | |
4 | 'base/js/utils', |
|
4 | 'base/js/utils', | |
5 | 'base/js/dialog', |
|
5 | 'base/js/dialog', | |
6 | 'base/js/notificationarea', |
|
6 | 'base/js/notificationarea', | |
7 | 'moment' |
|
7 | 'moment' | |
8 | ], function(IPython, $, utils, dialog, notificationarea, moment) { |
|
8 | ], function(IPython, $, utils, dialog, notificationarea, moment) { | |
9 | "use strict"; |
|
9 | "use strict"; | |
10 | var NotificationArea = notificationarea.NotificationArea; |
|
10 | var NotificationArea = notificationarea.NotificationArea; | |
11 |
|
11 | |||
12 | var NotebookNotificationArea = function(selector, options) { |
|
12 | var NotebookNotificationArea = function(selector, options) { | |
13 | NotificationArea.apply(this, [selector, options]); |
|
13 | NotificationArea.apply(this, [selector, options]); | |
14 | this.save_widget = options.save_widget; |
|
14 | this.save_widget = options.save_widget; | |
15 | this.notebook = options.notebook; |
|
15 | this.notebook = options.notebook; | |
16 | this.keyboard_manager = options.keyboard_manager; |
|
16 | this.keyboard_manager = options.keyboard_manager; | |
17 | }; |
|
17 | }; | |
18 |
|
18 | |||
19 | NotebookNotificationArea.prototype = Object.create(NotificationArea.prototype); |
|
19 | NotebookNotificationArea.prototype = Object.create(NotificationArea.prototype); | |
20 |
|
20 | |||
21 | /** |
|
21 | /** | |
22 | * Initialize the default set of notification widgets. |
|
22 | * Initialize the default set of notification widgets. | |
23 | * |
|
23 | * | |
24 | * @method init_notification_widgets |
|
24 | * @method init_notification_widgets | |
25 | */ |
|
25 | */ | |
26 | NotebookNotificationArea.prototype.init_notification_widgets = function () { |
|
26 | NotebookNotificationArea.prototype.init_notification_widgets = function () { | |
27 | this.init_kernel_notification_widget(); |
|
27 | this.init_kernel_notification_widget(); | |
28 | this.init_notebook_notification_widget(); |
|
28 | this.init_notebook_notification_widget(); | |
29 | }; |
|
29 | }; | |
30 |
|
30 | |||
31 | /** |
|
31 | /** | |
32 | * Initialize the notification widget for kernel status messages. |
|
32 | * Initialize the notification widget for kernel status messages. | |
33 | * |
|
33 | * | |
34 | * @method init_kernel_notification_widget |
|
34 | * @method init_kernel_notification_widget | |
35 | */ |
|
35 | */ | |
36 | NotebookNotificationArea.prototype.init_kernel_notification_widget = function () { |
|
36 | NotebookNotificationArea.prototype.init_kernel_notification_widget = function () { | |
37 | var that = this; |
|
37 | var that = this; | |
38 | var knw = this.new_notification_widget('kernel'); |
|
38 | var knw = this.new_notification_widget('kernel'); | |
39 | var $kernel_ind_icon = $("#kernel_indicator_icon"); |
|
39 | var $kernel_ind_icon = $("#kernel_indicator_icon"); | |
40 | var $modal_ind_icon = $("#modal_indicator"); |
|
40 | var $modal_ind_icon = $("#modal_indicator"); | |
|
41 | var $readonly_ind_icon = $('#readonly-indicator'); | |||
41 | var $body = $('body'); |
|
42 | var $body = $('body'); | |
42 |
|
43 | |||
|
44 | // Listen for the notebook loaded event. Set readonly indicator. | |||
|
45 | this.events.on('notebook_loaded.Notebook', function() { | |||
|
46 | if (that.notebook.writable) { | |||
|
47 | $readonly_ind_icon.hide(); | |||
|
48 | } else { | |||
|
49 | $readonly_ind_icon.show(); | |||
|
50 | } | |||
|
51 | }); | |||
|
52 | ||||
43 | // Command/Edit mode |
|
53 | // Command/Edit mode | |
44 | this.events.on('edit_mode.Notebook', function () { |
|
54 | this.events.on('edit_mode.Notebook', function () { | |
45 | that.save_widget.update_document_title(); |
|
55 | that.save_widget.update_document_title(); | |
46 | $body.addClass('edit_mode'); |
|
56 | $body.addClass('edit_mode'); | |
47 | $body.removeClass('command_mode'); |
|
57 | $body.removeClass('command_mode'); | |
48 | $modal_ind_icon.attr('title','Edit Mode'); |
|
58 | $modal_ind_icon.attr('title','Edit Mode'); | |
49 | }); |
|
59 | }); | |
50 |
|
60 | |||
51 | this.events.on('command_mode.Notebook', function () { |
|
61 | this.events.on('command_mode.Notebook', function () { | |
52 | that.save_widget.update_document_title(); |
|
62 | that.save_widget.update_document_title(); | |
53 | $body.removeClass('edit_mode'); |
|
63 | $body.removeClass('edit_mode'); | |
54 | $body.addClass('command_mode'); |
|
64 | $body.addClass('command_mode'); | |
55 | $modal_ind_icon.attr('title','Command Mode'); |
|
65 | $modal_ind_icon.attr('title','Command Mode'); | |
56 | }); |
|
66 | }); | |
57 |
|
67 | |||
58 | // Implicitly start off in Command mode, switching to Edit mode will trigger event |
|
68 | // Implicitly start off in Command mode, switching to Edit mode will trigger event | |
59 | $modal_ind_icon.addClass('modal_indicator').attr('title','Command Mode'); |
|
69 | $modal_ind_icon.addClass('modal_indicator').attr('title','Command Mode'); | |
60 | $body.addClass('command_mode'); |
|
70 | $body.addClass('command_mode'); | |
61 |
|
71 | |||
62 | // Kernel events |
|
72 | // Kernel events | |
63 |
|
73 | |||
64 | // this can be either kernel_created.Kernel or kernel_created.Session |
|
74 | // this can be either kernel_created.Kernel or kernel_created.Session | |
65 | this.events.on('kernel_created.Kernel kernel_created.Session', function () { |
|
75 | this.events.on('kernel_created.Kernel kernel_created.Session', function () { | |
66 | knw.info("Kernel Created", 500); |
|
76 | knw.info("Kernel Created", 500); | |
67 | }); |
|
77 | }); | |
68 |
|
78 | |||
69 | this.events.on('kernel_reconnecting.Kernel', function () { |
|
79 | this.events.on('kernel_reconnecting.Kernel', function () { | |
70 | knw.warning("Connecting to kernel"); |
|
80 | knw.warning("Connecting to kernel"); | |
71 | }); |
|
81 | }); | |
72 |
|
82 | |||
73 | this.events.on('kernel_connection_dead.Kernel', function (evt, info) { |
|
83 | this.events.on('kernel_connection_dead.Kernel', function (evt, info) { | |
74 | knw.danger("Not Connected", undefined, function () { |
|
84 | knw.danger("Not Connected", undefined, function () { | |
75 | // schedule reconnect a short time in the future, don't reconnect immediately |
|
85 | // schedule reconnect a short time in the future, don't reconnect immediately | |
76 | setTimeout($.proxy(info.kernel.reconnect, info.kernel), 500); |
|
86 | setTimeout($.proxy(info.kernel.reconnect, info.kernel), 500); | |
77 | }, {title: 'click to reconnect'}); |
|
87 | }, {title: 'click to reconnect'}); | |
78 | }); |
|
88 | }); | |
79 |
|
89 | |||
80 | this.events.on('kernel_connected.Kernel', function () { |
|
90 | this.events.on('kernel_connected.Kernel', function () { | |
81 | knw.info("Connected", 500); |
|
91 | knw.info("Connected", 500); | |
82 | }); |
|
92 | }); | |
83 |
|
93 | |||
84 | this.events.on('kernel_restarting.Kernel', function () { |
|
94 | this.events.on('kernel_restarting.Kernel', function () { | |
85 | that.save_widget.update_document_title(); |
|
95 | that.save_widget.update_document_title(); | |
86 | knw.set_message("Restarting kernel", 2000); |
|
96 | knw.set_message("Restarting kernel", 2000); | |
87 | }); |
|
97 | }); | |
88 |
|
98 | |||
89 | this.events.on('kernel_autorestarting.Kernel', function (evt, info) { |
|
99 | this.events.on('kernel_autorestarting.Kernel', function (evt, info) { | |
90 | // Only show the dialog on the first restart attempt. This |
|
100 | // Only show the dialog on the first restart attempt. This | |
91 | // number gets tracked by the `Kernel` object and passed |
|
101 | // number gets tracked by the `Kernel` object and passed | |
92 | // along here, because we don't want to show the user 5 |
|
102 | // along here, because we don't want to show the user 5 | |
93 | // dialogs saying the same thing (which is the number of |
|
103 | // dialogs saying the same thing (which is the number of | |
94 | // times it tries restarting). |
|
104 | // times it tries restarting). | |
95 | if (info.attempt === 1) { |
|
105 | if (info.attempt === 1) { | |
96 |
|
106 | |||
97 | dialog.kernel_modal({ |
|
107 | dialog.kernel_modal({ | |
98 | notebook: that.notebook, |
|
108 | notebook: that.notebook, | |
99 | keyboard_manager: that.keyboard_manager, |
|
109 | keyboard_manager: that.keyboard_manager, | |
100 | title: "Kernel Restarting", |
|
110 | title: "Kernel Restarting", | |
101 | body: "The kernel appears to have died. It will restart automatically.", |
|
111 | body: "The kernel appears to have died. It will restart automatically.", | |
102 | buttons: { |
|
112 | buttons: { | |
103 | OK : { |
|
113 | OK : { | |
104 | class : "btn-primary" |
|
114 | class : "btn-primary" | |
105 | } |
|
115 | } | |
106 | } |
|
116 | } | |
107 | }); |
|
117 | }); | |
108 | } |
|
118 | } | |
109 |
|
119 | |||
110 | that.save_widget.update_document_title(); |
|
120 | that.save_widget.update_document_title(); | |
111 | knw.danger("Dead kernel"); |
|
121 | knw.danger("Dead kernel"); | |
112 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); |
|
122 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); | |
113 | }); |
|
123 | }); | |
114 |
|
124 | |||
115 | this.events.on('kernel_interrupting.Kernel', function () { |
|
125 | this.events.on('kernel_interrupting.Kernel', function () { | |
116 | knw.set_message("Interrupting kernel", 2000); |
|
126 | knw.set_message("Interrupting kernel", 2000); | |
117 | }); |
|
127 | }); | |
118 |
|
128 | |||
119 | this.events.on('kernel_disconnected.Kernel', function () { |
|
129 | this.events.on('kernel_disconnected.Kernel', function () { | |
120 | $kernel_ind_icon |
|
130 | $kernel_ind_icon | |
121 | .attr('class', 'kernel_disconnected_icon') |
|
131 | .attr('class', 'kernel_disconnected_icon') | |
122 | .attr('title', 'No Connection to Kernel'); |
|
132 | .attr('title', 'No Connection to Kernel'); | |
123 | }); |
|
133 | }); | |
124 |
|
134 | |||
125 | this.events.on('kernel_connection_failed.Kernel', function (evt, info) { |
|
135 | this.events.on('kernel_connection_failed.Kernel', function (evt, info) { | |
126 | // only show the dialog if this is the first failed |
|
136 | // only show the dialog if this is the first failed | |
127 | // connect attempt, because the kernel will continue |
|
137 | // connect attempt, because the kernel will continue | |
128 | // trying to reconnect and we don't want to spam the user |
|
138 | // trying to reconnect and we don't want to spam the user | |
129 | // with messages |
|
139 | // with messages | |
130 | if (info.attempt === 1) { |
|
140 | if (info.attempt === 1) { | |
131 |
|
141 | |||
132 | var msg = "A connection to the notebook server could not be established." + |
|
142 | var msg = "A connection to the notebook server could not be established." + | |
133 | " The notebook will continue trying to reconnect, but" + |
|
143 | " The notebook will continue trying to reconnect, but" + | |
134 | " until it does, you will NOT be able to run code. Check your" + |
|
144 | " until it does, you will NOT be able to run code. Check your" + | |
135 | " network connection or notebook server configuration."; |
|
145 | " network connection or notebook server configuration."; | |
136 |
|
146 | |||
137 | dialog.kernel_modal({ |
|
147 | dialog.kernel_modal({ | |
138 | title: "Connection failed", |
|
148 | title: "Connection failed", | |
139 | body: msg, |
|
149 | body: msg, | |
140 | keyboard_manager: that.keyboard_manager, |
|
150 | keyboard_manager: that.keyboard_manager, | |
141 | notebook: that.notebook, |
|
151 | notebook: that.notebook, | |
142 | buttons : { |
|
152 | buttons : { | |
143 | "OK": {} |
|
153 | "OK": {} | |
144 | } |
|
154 | } | |
145 | }); |
|
155 | }); | |
146 | } |
|
156 | } | |
147 | }); |
|
157 | }); | |
148 |
|
158 | |||
149 | this.events.on('kernel_killed.Kernel kernel_killed.Session', function () { |
|
159 | this.events.on('kernel_killed.Kernel kernel_killed.Session', function () { | |
150 | that.save_widget.update_document_title(); |
|
160 | that.save_widget.update_document_title(); | |
151 | knw.warning("No kernel"); |
|
161 | knw.warning("No kernel"); | |
152 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel is not running'); |
|
162 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel is not running'); | |
153 | }); |
|
163 | }); | |
154 |
|
164 | |||
155 | this.events.on('kernel_dead.Kernel', function () { |
|
165 | this.events.on('kernel_dead.Kernel', function () { | |
156 |
|
166 | |||
157 | var showMsg = function () { |
|
167 | var showMsg = function () { | |
158 |
|
168 | |||
159 | var msg = 'The kernel has died, and the automatic restart has failed.' + |
|
169 | var msg = 'The kernel has died, and the automatic restart has failed.' + | |
160 | ' It is possible the kernel cannot be restarted.' + |
|
170 | ' It is possible the kernel cannot be restarted.' + | |
161 | ' If you are not able to restart the kernel, you will still be able to save' + |
|
171 | ' If you are not able to restart the kernel, you will still be able to save' + | |
162 | ' the notebook, but running code will no longer work until the notebook' + |
|
172 | ' the notebook, but running code will no longer work until the notebook' + | |
163 | ' is reopened.'; |
|
173 | ' is reopened.'; | |
164 |
|
174 | |||
165 | dialog.kernel_modal({ |
|
175 | dialog.kernel_modal({ | |
166 | title: "Dead kernel", |
|
176 | title: "Dead kernel", | |
167 | body : msg, |
|
177 | body : msg, | |
168 | keyboard_manager: that.keyboard_manager, |
|
178 | keyboard_manager: that.keyboard_manager, | |
169 | notebook: that.notebook, |
|
179 | notebook: that.notebook, | |
170 | buttons : { |
|
180 | buttons : { | |
171 | "Manual Restart": { |
|
181 | "Manual Restart": { | |
172 | class: "btn-danger", |
|
182 | class: "btn-danger", | |
173 | click: function () { |
|
183 | click: function () { | |
174 | that.notebook.start_session(); |
|
184 | that.notebook.start_session(); | |
175 | } |
|
185 | } | |
176 | }, |
|
186 | }, | |
177 | "Don't restart": {} |
|
187 | "Don't restart": {} | |
178 | } |
|
188 | } | |
179 | }); |
|
189 | }); | |
180 |
|
190 | |||
181 | return false; |
|
191 | return false; | |
182 | }; |
|
192 | }; | |
183 |
|
193 | |||
184 | that.save_widget.update_document_title(); |
|
194 | that.save_widget.update_document_title(); | |
185 | knw.danger("Dead kernel", undefined, showMsg); |
|
195 | knw.danger("Dead kernel", undefined, showMsg); | |
186 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); |
|
196 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); | |
187 |
|
197 | |||
188 | showMsg(); |
|
198 | showMsg(); | |
189 | }); |
|
199 | }); | |
190 |
|
200 | |||
191 | this.events.on("no_kernel.Kernel", function (evt, data) { |
|
201 | this.events.on("no_kernel.Kernel", function (evt, data) { | |
192 | $("#kernel_indicator").find('.kernel_indicator_name').text("No Kernel"); |
|
202 | $("#kernel_indicator").find('.kernel_indicator_name').text("No Kernel"); | |
193 | }); |
|
203 | }); | |
194 |
|
204 | |||
195 | this.events.on('kernel_dead.Session', function (evt, info) { |
|
205 | this.events.on('kernel_dead.Session', function (evt, info) { | |
196 | var full = info.xhr.responseJSON.message; |
|
206 | var full = info.xhr.responseJSON.message; | |
197 | var short = info.xhr.responseJSON.short_message || 'Kernel error'; |
|
207 | var short = info.xhr.responseJSON.short_message || 'Kernel error'; | |
198 | var traceback = info.xhr.responseJSON.traceback; |
|
208 | var traceback = info.xhr.responseJSON.traceback; | |
199 |
|
209 | |||
200 | var showMsg = function () { |
|
210 | var showMsg = function () { | |
201 | var msg = $('<div/>').append($('<p/>').text(full)); |
|
211 | var msg = $('<div/>').append($('<p/>').text(full)); | |
202 | var cm, cm_elem, cm_open; |
|
212 | var cm, cm_elem, cm_open; | |
203 |
|
213 | |||
204 | if (traceback) { |
|
214 | if (traceback) { | |
205 | cm_elem = $('<div/>') |
|
215 | cm_elem = $('<div/>') | |
206 | .css('margin-top', '1em') |
|
216 | .css('margin-top', '1em') | |
207 | .css('padding', '1em') |
|
217 | .css('padding', '1em') | |
208 | .addClass('output_scroll'); |
|
218 | .addClass('output_scroll'); | |
209 | msg.append(cm_elem); |
|
219 | msg.append(cm_elem); | |
210 | cm = CodeMirror(cm_elem.get(0), { |
|
220 | cm = CodeMirror(cm_elem.get(0), { | |
211 | mode: "python", |
|
221 | mode: "python", | |
212 | readOnly : true |
|
222 | readOnly : true | |
213 | }); |
|
223 | }); | |
214 | cm.setValue(traceback); |
|
224 | cm.setValue(traceback); | |
215 | cm_open = $.proxy(cm.refresh, cm); |
|
225 | cm_open = $.proxy(cm.refresh, cm); | |
216 | } |
|
226 | } | |
217 |
|
227 | |||
218 | dialog.kernel_modal({ |
|
228 | dialog.kernel_modal({ | |
219 | title: "Failed to start the kernel", |
|
229 | title: "Failed to start the kernel", | |
220 | body : msg, |
|
230 | body : msg, | |
221 | keyboard_manager: that.keyboard_manager, |
|
231 | keyboard_manager: that.keyboard_manager, | |
222 | notebook: that.notebook, |
|
232 | notebook: that.notebook, | |
223 | open: cm_open, |
|
233 | open: cm_open, | |
224 | buttons : { |
|
234 | buttons : { | |
225 | "Ok": { class: 'btn-primary' } |
|
235 | "Ok": { class: 'btn-primary' } | |
226 | } |
|
236 | } | |
227 | }); |
|
237 | }); | |
228 |
|
238 | |||
229 | return false; |
|
239 | return false; | |
230 | }; |
|
240 | }; | |
231 |
|
241 | |||
232 | that.save_widget.update_document_title(); |
|
242 | that.save_widget.update_document_title(); | |
233 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); |
|
243 | $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); | |
234 | knw.danger(short, undefined, showMsg); |
|
244 | knw.danger(short, undefined, showMsg); | |
235 | }); |
|
245 | }); | |
236 |
|
246 | |||
237 | this.events.on('kernel_starting.Kernel kernel_created.Session', function () { |
|
247 | this.events.on('kernel_starting.Kernel kernel_created.Session', function () { | |
238 | window.document.title='(Starting) '+window.document.title; |
|
248 | window.document.title='(Starting) '+window.document.title; | |
239 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); |
|
249 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); | |
240 | knw.set_message("Kernel starting, please wait..."); |
|
250 | knw.set_message("Kernel starting, please wait..."); | |
241 | }); |
|
251 | }); | |
242 |
|
252 | |||
243 | this.events.on('kernel_ready.Kernel', function () { |
|
253 | this.events.on('kernel_ready.Kernel', function () { | |
244 | that.save_widget.update_document_title(); |
|
254 | that.save_widget.update_document_title(); | |
245 | $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); |
|
255 | $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); | |
246 | knw.info("Kernel ready", 500); |
|
256 | knw.info("Kernel ready", 500); | |
247 | }); |
|
257 | }); | |
248 |
|
258 | |||
249 | this.events.on('kernel_idle.Kernel', function () { |
|
259 | this.events.on('kernel_idle.Kernel', function () { | |
250 | that.save_widget.update_document_title(); |
|
260 | that.save_widget.update_document_title(); | |
251 | $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); |
|
261 | $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); | |
252 | }); |
|
262 | }); | |
253 |
|
263 | |||
254 | this.events.on('kernel_busy.Kernel', function () { |
|
264 | this.events.on('kernel_busy.Kernel', function () { | |
255 | window.document.title='(Busy) '+window.document.title; |
|
265 | window.document.title='(Busy) '+window.document.title; | |
256 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); |
|
266 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); | |
257 | }); |
|
267 | }); | |
258 |
|
268 | |||
259 | this.events.on('spec_match_found.Kernel', function (evt, data) { |
|
269 | this.events.on('spec_match_found.Kernel', function (evt, data) { | |
260 | that.widget('kernelspec').info("Using kernel: " + data.found.spec.display_name, 3000, undefined, { |
|
270 | that.widget('kernelspec').info("Using kernel: " + data.found.spec.display_name, 3000, undefined, { | |
261 | title: "Only candidate for language: " + data.selected.language + " was " + data.found.spec.display_name |
|
271 | title: "Only candidate for language: " + data.selected.language + " was " + data.found.spec.display_name | |
262 | }); |
|
272 | }); | |
263 | }); |
|
273 | }); | |
264 |
|
274 | |||
265 |
|
275 | |||
266 | // Start the kernel indicator in the busy state, and send a kernel_info request. |
|
276 | // Start the kernel indicator in the busy state, and send a kernel_info request. | |
267 | // When the kernel_info reply arrives, the kernel is idle. |
|
277 | // When the kernel_info reply arrives, the kernel is idle. | |
268 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); |
|
278 | $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); | |
269 | }; |
|
279 | }; | |
270 |
|
280 | |||
271 | /** |
|
281 | /** | |
272 | * Initialize the notification widget for notebook status messages. |
|
282 | * Initialize the notification widget for notebook status messages. | |
273 | * |
|
283 | * | |
274 | * @method init_notebook_notification_widget |
|
284 | * @method init_notebook_notification_widget | |
275 | */ |
|
285 | */ | |
276 | NotebookNotificationArea.prototype.init_notebook_notification_widget = function () { |
|
286 | NotebookNotificationArea.prototype.init_notebook_notification_widget = function () { | |
277 | var nnw = this.new_notification_widget('notebook'); |
|
287 | var nnw = this.new_notification_widget('notebook'); | |
278 |
|
288 | |||
279 | // Notebook events |
|
289 | // Notebook events | |
280 | this.events.on('notebook_loading.Notebook', function () { |
|
290 | this.events.on('notebook_loading.Notebook', function () { | |
281 | nnw.set_message("Loading notebook",500); |
|
291 | nnw.set_message("Loading notebook",500); | |
282 | }); |
|
292 | }); | |
283 | this.events.on('notebook_loaded.Notebook', function () { |
|
293 | this.events.on('notebook_loaded.Notebook', function () { | |
284 | nnw.set_message("Notebook loaded",500); |
|
294 | nnw.set_message("Notebook loaded",500); | |
285 | }); |
|
295 | }); | |
286 | this.events.on('notebook_saving.Notebook', function () { |
|
296 | this.events.on('notebook_saving.Notebook', function () { | |
287 | nnw.set_message("Saving notebook",500); |
|
297 | nnw.set_message("Saving notebook",500); | |
288 | }); |
|
298 | }); | |
289 | this.events.on('notebook_saved.Notebook', function () { |
|
299 | this.events.on('notebook_saved.Notebook', function () { | |
290 | nnw.set_message("Notebook saved",2000); |
|
300 | nnw.set_message("Notebook saved",2000); | |
291 | }); |
|
301 | }); | |
292 | this.events.on('notebook_save_failed.Notebook', function (evt, error) { |
|
302 | this.events.on('notebook_save_failed.Notebook', function (evt, error) { | |
293 | nnw.warning(error.message || "Notebook save failed"); |
|
303 | nnw.warning(error.message || "Notebook save failed"); | |
294 | }); |
|
304 | }); | |
295 | this.events.on('notebook_copy_failed.Notebook', function (evt, error) { |
|
305 | this.events.on('notebook_copy_failed.Notebook', function (evt, error) { | |
296 | nnw.warning(error.message || "Notebook copy failed"); |
|
306 | nnw.warning(error.message || "Notebook copy failed"); | |
297 | }); |
|
307 | }); | |
298 |
|
308 | |||
299 | // Checkpoint events |
|
309 | // Checkpoint events | |
300 | this.events.on('checkpoint_created.Notebook', function (evt, data) { |
|
310 | this.events.on('checkpoint_created.Notebook', function (evt, data) { | |
301 | var msg = "Checkpoint created"; |
|
311 | var msg = "Checkpoint created"; | |
302 | if (data.last_modified) { |
|
312 | if (data.last_modified) { | |
303 | var d = new Date(data.last_modified); |
|
313 | var d = new Date(data.last_modified); | |
304 | msg = msg + ": " + moment(d).format("HH:mm:ss"); |
|
314 | msg = msg + ": " + moment(d).format("HH:mm:ss"); | |
305 | } |
|
315 | } | |
306 | nnw.set_message(msg, 2000); |
|
316 | nnw.set_message(msg, 2000); | |
307 | }); |
|
317 | }); | |
308 | this.events.on('checkpoint_failed.Notebook', function () { |
|
318 | this.events.on('checkpoint_failed.Notebook', function () { | |
309 | nnw.warning("Checkpoint failed"); |
|
319 | nnw.warning("Checkpoint failed"); | |
310 | }); |
|
320 | }); | |
311 | this.events.on('checkpoint_deleted.Notebook', function () { |
|
321 | this.events.on('checkpoint_deleted.Notebook', function () { | |
312 | nnw.set_message("Checkpoint deleted", 500); |
|
322 | nnw.set_message("Checkpoint deleted", 500); | |
313 | }); |
|
323 | }); | |
314 | this.events.on('checkpoint_delete_failed.Notebook', function () { |
|
324 | this.events.on('checkpoint_delete_failed.Notebook', function () { | |
315 | nnw.warning("Checkpoint delete failed"); |
|
325 | nnw.warning("Checkpoint delete failed"); | |
316 | }); |
|
326 | }); | |
317 | this.events.on('checkpoint_restoring.Notebook', function () { |
|
327 | this.events.on('checkpoint_restoring.Notebook', function () { | |
318 | nnw.set_message("Restoring to checkpoint...", 500); |
|
328 | nnw.set_message("Restoring to checkpoint...", 500); | |
319 | }); |
|
329 | }); | |
320 | this.events.on('checkpoint_restore_failed.Notebook', function () { |
|
330 | this.events.on('checkpoint_restore_failed.Notebook', function () { | |
321 | nnw.warning("Checkpoint restore failed"); |
|
331 | nnw.warning("Checkpoint restore failed"); | |
322 | }); |
|
332 | }); | |
323 |
|
333 | |||
324 | // Autosave events |
|
334 | // Autosave events | |
325 | this.events.on('autosave_disabled.Notebook', function () { |
|
335 | this.events.on('autosave_disabled.Notebook', function () { | |
326 | nnw.set_message("Autosave disabled", 2000); |
|
336 | nnw.set_message("Autosave disabled", 2000); | |
327 | }); |
|
337 | }); | |
328 | this.events.on('autosave_enabled.Notebook', function (evt, interval) { |
|
338 | this.events.on('autosave_enabled.Notebook', function (evt, interval) { | |
329 | nnw.set_message("Saving every " + interval / 1000 + "s", 1000); |
|
339 | nnw.set_message("Saving every " + interval / 1000 + "s", 1000); | |
330 | }); |
|
340 | }); | |
331 | }; |
|
341 | }; | |
332 |
|
342 | |||
333 | // Backwards compatibility. |
|
343 | // Backwards compatibility. | |
334 | IPython.NotificationArea = NotebookNotificationArea; |
|
344 | IPython.NotificationArea = NotebookNotificationArea; | |
335 |
|
345 | |||
336 | return {'NotebookNotificationArea': NotebookNotificationArea}; |
|
346 | return {'NotebookNotificationArea': NotebookNotificationArea}; | |
337 | }); |
|
347 | }); |
@@ -1,61 +1,71 b'' | |||||
1 | #notification_area { |
|
1 | #notification_area { | |
2 | .pull-right(); |
|
2 | .pull-right(); | |
3 | z-index: 10; |
|
3 | z-index: 10; | |
4 | } |
|
4 | } | |
5 |
|
5 | |||
6 | .indicator_area { |
|
6 | .indicator_area { | |
7 | .pull-right(); |
|
7 | .pull-right(); | |
8 | color: @navbar-default-link-color; |
|
8 | color: @navbar-default-link-color; | |
9 | margin-left: 5px; |
|
9 | margin-left: 5px; | |
10 | margin-right: 5px; |
|
10 | margin-right: 5px; | |
11 | width: 11px; |
|
11 | width: 11px; | |
12 | z-index: 10; |
|
12 | z-index: 10; | |
13 | text-align: center; |
|
13 | text-align: center; | |
14 | width: auto; |
|
14 | width: auto; | |
15 | } |
|
15 | } | |
16 |
|
16 | |||
17 | #kernel_indicator { |
|
17 | #kernel_indicator { | |
18 | .indicator_area(); |
|
18 | .indicator_area(); | |
19 |
|
19 | |||
20 | border-left: 1px solid; |
|
20 | border-left: 1px solid; | |
21 |
|
21 | |||
22 | .kernel_indicator_name { |
|
22 | .kernel_indicator_name { | |
23 | padding-left: 5px; |
|
23 | padding-left: 5px; | |
24 | padding-right: 5px; |
|
24 | padding-right: 5px; | |
25 | } |
|
25 | } | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | #modal_indicator { |
|
28 | #modal_indicator { | |
29 | .pull-right(); |
|
29 | .pull-right(); | |
30 | .indicator_area(); |
|
30 | .indicator_area(); | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
|
33 | #readonly-indicator { | |||
|
34 | .pull-right(); | |||
|
35 | .indicator_area(); | |||
|
36 | ||||
|
37 | margin-top: 2px; | |||
|
38 | margin-bottom: 0px; | |||
|
39 | margin-left: 0px; | |||
|
40 | margin-right: 0px; | |||
|
41 | } | |||
|
42 | ||||
33 | .modal_indicator:before { |
|
43 | .modal_indicator:before { | |
34 | .fa-fw(); |
|
44 | .fa-fw(); | |
35 | } |
|
45 | } | |
36 |
|
46 | |||
37 | .edit_mode .modal_indicator:before { |
|
47 | .edit_mode .modal_indicator:before { | |
38 | .icon(@fa-var-pencil); |
|
48 | .icon(@fa-var-pencil); | |
39 | } |
|
49 | } | |
40 |
|
50 | |||
41 | .command_mode .modal_indicator:before { |
|
51 | .command_mode .modal_indicator:before { | |
42 | .icon(' '); |
|
52 | .icon(' '); | |
43 | } |
|
53 | } | |
44 |
|
54 | |||
45 | .kernel_idle_icon:before { |
|
55 | .kernel_idle_icon:before { | |
46 | .icon(@fa-var-circle-o); |
|
56 | .icon(@fa-var-circle-o); | |
47 | } |
|
57 | } | |
48 |
|
58 | |||
49 | .kernel_busy_icon:before { |
|
59 | .kernel_busy_icon:before { | |
50 | .icon(@fa-var-circle); |
|
60 | .icon(@fa-var-circle); | |
51 | } |
|
61 | } | |
52 |
|
62 | |||
53 | .kernel_dead_icon:before { |
|
63 | .kernel_dead_icon:before { | |
54 | .icon(@fa-var-bomb); |
|
64 | .icon(@fa-var-bomb); | |
55 | } |
|
65 | } | |
56 |
|
66 | |||
57 | .kernel_disconnected_icon:before { |
|
67 | .kernel_disconnected_icon:before { | |
58 | .icon(@fa-var-chain-broken); |
|
68 | .icon(@fa-var-chain-broken); | |
59 | } |
|
69 | } | |
60 |
|
70 | |||
61 |
|
71 |
@@ -1,321 +1,327 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"> | |||
|
66 | <span class="fa-stack"> | |||
|
67 | <i class="fa fa-save fa-stack-1x"></i> | |||
|
68 | <i class="fa fa-ban fa-stack-2x text-danger"></i> | |||
|
69 | </span> | |||
|
70 | </i> | |||
65 | <i id="modal_indicator" class="navbar-text"></i> |
|
71 | <i id="modal_indicator" class="navbar-text"></i> | |
66 | <span id="notification_area"></span> |
|
72 | <span id="notification_area"></span> | |
67 | <div class="navbar-collapse collapse"> |
|
73 | <div class="navbar-collapse collapse"> | |
68 | <ul class="nav navbar-nav"> |
|
74 | <ul class="nav navbar-nav"> | |
69 | <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> | |
70 | <ul id="file_menu" class="dropdown-menu"> |
|
76 | <ul id="file_menu" class="dropdown-menu"> | |
71 | <li id="new_notebook" class="dropdown-submenu"> |
|
77 | <li id="new_notebook" class="dropdown-submenu"> | |
72 | <a href="#">New Notebook</a> |
|
78 | <a href="#">New Notebook</a> | |
73 | <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul> |
|
79 | <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul> | |
74 | </li> |
|
80 | </li> | |
75 | <li id="open_notebook" |
|
81 | <li id="open_notebook" | |
76 | title="Opens a new window with the Dashboard view"> |
|
82 | title="Opens a new window with the Dashboard view"> | |
77 | <a href="#">Open...</a></li> |
|
83 | <a href="#">Open...</a></li> | |
78 | <!-- <hr/> --> |
|
84 | <!-- <hr/> --> | |
79 | <li class="divider"></li> |
|
85 | <li class="divider"></li> | |
80 | <li id="copy_notebook" |
|
86 | <li id="copy_notebook" | |
81 | 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"> | |
82 | <a href="#">Make a Copy...</a></li> |
|
88 | <a href="#">Make a Copy...</a></li> | |
83 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
89 | <li id="rename_notebook"><a href="#">Rename...</a></li> | |
84 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> |
|
90 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> | |
85 | <!-- <hr/> --> |
|
91 | <!-- <hr/> --> | |
86 | <li class="divider"></li> |
|
92 | <li class="divider"></li> | |
87 | <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> | |
88 | <ul class="dropdown-menu"> |
|
94 | <ul class="dropdown-menu"> | |
89 | <li><a href="#"></a></li> |
|
95 | <li><a href="#"></a></li> | |
90 | <li><a href="#"></a></li> |
|
96 | <li><a href="#"></a></li> | |
91 | <li><a href="#"></a></li> |
|
97 | <li><a href="#"></a></li> | |
92 | <li><a href="#"></a></li> |
|
98 | <li><a href="#"></a></li> | |
93 | <li><a href="#"></a></li> |
|
99 | <li><a href="#"></a></li> | |
94 | </ul> |
|
100 | </ul> | |
95 | </li> |
|
101 | </li> | |
96 | <li class="divider"></li> |
|
102 | <li class="divider"></li> | |
97 | <li id="print_preview"><a href="#">Print Preview</a></li> |
|
103 | <li id="print_preview"><a href="#">Print Preview</a></li> | |
98 | <li class="dropdown-submenu"><a href="#">Download as</a> |
|
104 | <li class="dropdown-submenu"><a href="#">Download as</a> | |
99 | <ul class="dropdown-menu"> |
|
105 | <ul class="dropdown-menu"> | |
100 | <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li> |
|
106 | <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li> | |
101 | <li id="download_script"><a href="#">Script</a></li> |
|
107 | <li id="download_script"><a href="#">Script</a></li> | |
102 | <li id="download_html"><a href="#">HTML (.html)</a></li> |
|
108 | <li id="download_html"><a href="#">HTML (.html)</a></li> | |
103 | <li id="download_rst"><a href="#">reST (.rst)</a></li> |
|
109 | <li id="download_rst"><a href="#">reST (.rst)</a></li> | |
104 | <li id="download_pdf"><a href="#">PDF (.pdf)</a></li> |
|
110 | <li id="download_pdf"><a href="#">PDF (.pdf)</a></li> | |
105 | </ul> |
|
111 | </ul> | |
106 | </li> |
|
112 | </li> | |
107 | <li class="divider"></li> |
|
113 | <li class="divider"></li> | |
108 | <li id="trust_notebook" |
|
114 | <li id="trust_notebook" | |
109 | title="Trust the output of this notebook"> |
|
115 | title="Trust the output of this notebook"> | |
110 | <a href="#" >Trust Notebook</a></li> |
|
116 | <a href="#" >Trust Notebook</a></li> | |
111 | <li class="divider"></li> |
|
117 | <li class="divider"></li> | |
112 | <li id="kill_and_exit" |
|
118 | <li id="kill_and_exit" | |
113 | title="Shutdown this notebook's kernel, and close this window"> |
|
119 | title="Shutdown this notebook's kernel, and close this window"> | |
114 | <a href="#" >Close and halt</a></li> |
|
120 | <a href="#" >Close and halt</a></li> | |
115 | </ul> |
|
121 | </ul> | |
116 | </li> |
|
122 | </li> | |
117 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
|
123 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> | |
118 | <ul id="edit_menu" class="dropdown-menu"> |
|
124 | <ul id="edit_menu" class="dropdown-menu"> | |
119 | <li id="cut_cell"><a href="#">Cut Cell</a></li> |
|
125 | <li id="cut_cell"><a href="#">Cut Cell</a></li> | |
120 | <li id="copy_cell"><a href="#">Copy Cell</a></li> |
|
126 | <li id="copy_cell"><a href="#">Copy Cell</a></li> | |
121 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> |
|
127 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> | |
122 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> |
|
128 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> | |
123 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> |
|
129 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> | |
124 | <li id="delete_cell"><a href="#">Delete Cell</a></li> |
|
130 | <li id="delete_cell"><a href="#">Delete Cell</a></li> | |
125 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> |
|
131 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> | |
126 | <li class="divider"></li> |
|
132 | <li class="divider"></li> | |
127 | <li id="split_cell"><a href="#">Split Cell</a></li> |
|
133 | <li id="split_cell"><a href="#">Split Cell</a></li> | |
128 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> |
|
134 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> | |
129 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> |
|
135 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> | |
130 | <li class="divider"></li> |
|
136 | <li class="divider"></li> | |
131 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> |
|
137 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> | |
132 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
138 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> | |
133 | <li class="divider"></li> |
|
139 | <li class="divider"></li> | |
134 | <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li> |
|
140 | <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li> | |
135 | </ul> |
|
141 | </ul> | |
136 | </li> |
|
142 | </li> | |
137 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> |
|
143 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> | |
138 | <ul id="view_menu" class="dropdown-menu"> |
|
144 | <ul id="view_menu" class="dropdown-menu"> | |
139 | <li id="toggle_header" |
|
145 | <li id="toggle_header" | |
140 | title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)"> |
|
146 | title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)"> | |
141 | <a href="#">Toggle Header</a></li> |
|
147 | <a href="#">Toggle Header</a></li> | |
142 | <li id="toggle_toolbar" |
|
148 | <li id="toggle_toolbar" | |
143 | title="Show/Hide the action icons (below menu bar)"> |
|
149 | title="Show/Hide the action icons (below menu bar)"> | |
144 | <a href="#">Toggle Toolbar</a></li> |
|
150 | <a href="#">Toggle Toolbar</a></li> | |
145 | </ul> |
|
151 | </ul> | |
146 | </li> |
|
152 | </li> | |
147 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> |
|
153 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> | |
148 | <ul id="insert_menu" class="dropdown-menu"> |
|
154 | <ul id="insert_menu" class="dropdown-menu"> | |
149 | <li id="insert_cell_above" |
|
155 | <li id="insert_cell_above" | |
150 | title="Insert an empty Code cell above the currently active cell"> |
|
156 | title="Insert an empty Code cell above the currently active cell"> | |
151 | <a href="#">Insert Cell Above</a></li> |
|
157 | <a href="#">Insert Cell Above</a></li> | |
152 | <li id="insert_cell_below" |
|
158 | <li id="insert_cell_below" | |
153 | title="Insert an empty Code cell below the currently active cell"> |
|
159 | title="Insert an empty Code cell below the currently active cell"> | |
154 | <a href="#">Insert Cell Below</a></li> |
|
160 | <a href="#">Insert Cell Below</a></li> | |
155 | </ul> |
|
161 | </ul> | |
156 | </li> |
|
162 | </li> | |
157 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> |
|
163 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> | |
158 | <ul id="cell_menu" class="dropdown-menu"> |
|
164 | <ul id="cell_menu" class="dropdown-menu"> | |
159 | <li id="run_cell" title="Run this cell, and move cursor to the next one"> |
|
165 | <li id="run_cell" title="Run this cell, and move cursor to the next one"> | |
160 | <a href="#">Run</a></li> |
|
166 | <a href="#">Run</a></li> | |
161 | <li id="run_cell_select_below" title="Run this cell, select below"> |
|
167 | <li id="run_cell_select_below" title="Run this cell, select below"> | |
162 | <a href="#">Run and Select Below</a></li> |
|
168 | <a href="#">Run and Select Below</a></li> | |
163 | <li id="run_cell_insert_below" title="Run this cell, insert below"> |
|
169 | <li id="run_cell_insert_below" title="Run this cell, insert below"> | |
164 | <a href="#">Run and Insert Below</a></li> |
|
170 | <a href="#">Run and Insert Below</a></li> | |
165 | <li id="run_all_cells" title="Run all cells in the notebook"> |
|
171 | <li id="run_all_cells" title="Run all cells in the notebook"> | |
166 | <a href="#">Run All</a></li> |
|
172 | <a href="#">Run All</a></li> | |
167 | <li id="run_all_cells_above" title="Run all cells above (but not including) this cell"> |
|
173 | <li id="run_all_cells_above" title="Run all cells above (but not including) this cell"> | |
168 | <a href="#">Run All Above</a></li> |
|
174 | <a href="#">Run All Above</a></li> | |
169 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> |
|
175 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> | |
170 | <a href="#">Run All Below</a></li> |
|
176 | <a href="#">Run All Below</a></li> | |
171 | <li class="divider"></li> |
|
177 | <li class="divider"></li> | |
172 | <li id="change_cell_type" class="dropdown-submenu" |
|
178 | <li id="change_cell_type" class="dropdown-submenu" | |
173 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> |
|
179 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> | |
174 | <a href="#">Cell Type</a> |
|
180 | <a href="#">Cell Type</a> | |
175 | <ul class="dropdown-menu"> |
|
181 | <ul class="dropdown-menu"> | |
176 | <li id="to_code" |
|
182 | <li id="to_code" | |
177 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> |
|
183 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> | |
178 | <a href="#">Code</a></li> |
|
184 | <a href="#">Code</a></li> | |
179 | <li id="to_markdown" |
|
185 | <li id="to_markdown" | |
180 | title="Contents will be rendered as HTML and serve as explanatory text"> |
|
186 | title="Contents will be rendered as HTML and serve as explanatory text"> | |
181 | <a href="#">Markdown</a></li> |
|
187 | <a href="#">Markdown</a></li> | |
182 | <li id="to_raw" |
|
188 | <li id="to_raw" | |
183 | title="Contents will pass through nbconvert unmodified"> |
|
189 | title="Contents will pass through nbconvert unmodified"> | |
184 | <a href="#">Raw NBConvert</a></li> |
|
190 | <a href="#">Raw NBConvert</a></li> | |
185 | </ul> |
|
191 | </ul> | |
186 | </li> |
|
192 | </li> | |
187 | <li class="divider"></li> |
|
193 | <li class="divider"></li> | |
188 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> |
|
194 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> | |
189 | <ul class="dropdown-menu"> |
|
195 | <ul class="dropdown-menu"> | |
190 | <li id="toggle_current_output" |
|
196 | <li id="toggle_current_output" | |
191 | title="Hide/Show the output of the current cell"> |
|
197 | title="Hide/Show the output of the current cell"> | |
192 | <a href="#">Toggle</a> |
|
198 | <a href="#">Toggle</a> | |
193 | </li> |
|
199 | </li> | |
194 | <li id="toggle_current_output_scroll" |
|
200 | <li id="toggle_current_output_scroll" | |
195 | title="Scroll the output of the current cell"> |
|
201 | title="Scroll the output of the current cell"> | |
196 | <a href="#">Toggle Scrolling</a> |
|
202 | <a href="#">Toggle Scrolling</a> | |
197 | </li> |
|
203 | </li> | |
198 | <li id="clear_current_output" |
|
204 | <li id="clear_current_output" | |
199 | title="Clear the output of the current cell"> |
|
205 | title="Clear the output of the current cell"> | |
200 | <a href="#">Clear</a> |
|
206 | <a href="#">Clear</a> | |
201 | </li> |
|
207 | </li> | |
202 | </ul> |
|
208 | </ul> | |
203 | </li> |
|
209 | </li> | |
204 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> |
|
210 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> | |
205 | <ul class="dropdown-menu"> |
|
211 | <ul class="dropdown-menu"> | |
206 | <li id="toggle_all_output" |
|
212 | <li id="toggle_all_output" | |
207 | title="Hide/Show the output of all cells"> |
|
213 | title="Hide/Show the output of all cells"> | |
208 | <a href="#">Toggle</a> |
|
214 | <a href="#">Toggle</a> | |
209 | </li> |
|
215 | </li> | |
210 | <li id="toggle_all_output_scroll" |
|
216 | <li id="toggle_all_output_scroll" | |
211 | title="Scroll the output of all cells"> |
|
217 | title="Scroll the output of all cells"> | |
212 | <a href="#">Toggle Scrolling</a> |
|
218 | <a href="#">Toggle Scrolling</a> | |
213 | </li> |
|
219 | </li> | |
214 | <li id="clear_all_output" |
|
220 | <li id="clear_all_output" | |
215 | title="Clear the output of all cells"> |
|
221 | title="Clear the output of all cells"> | |
216 | <a href="#">Clear</a> |
|
222 | <a href="#">Clear</a> | |
217 | </li> |
|
223 | </li> | |
218 | </ul> |
|
224 | </ul> | |
219 | </li> |
|
225 | </li> | |
220 | </ul> |
|
226 | </ul> | |
221 | </li> |
|
227 | </li> | |
222 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> |
|
228 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> | |
223 | <ul id="kernel_menu" class="dropdown-menu"> |
|
229 | <ul id="kernel_menu" class="dropdown-menu"> | |
224 | <li id="int_kernel" |
|
230 | <li id="int_kernel" | |
225 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> |
|
231 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> | |
226 | <a href="#">Interrupt</a> |
|
232 | <a href="#">Interrupt</a> | |
227 | </li> |
|
233 | </li> | |
228 | <li id="restart_kernel" |
|
234 | <li id="restart_kernel" | |
229 | title="Restart the Kernel"> |
|
235 | title="Restart the Kernel"> | |
230 | <a href="#">Restart</a> |
|
236 | <a href="#">Restart</a> | |
231 | </li> |
|
237 | </li> | |
232 | <li id="reconnect_kernel" |
|
238 | <li id="reconnect_kernel" | |
233 | title="Reconnect to the Kernel"> |
|
239 | title="Reconnect to the Kernel"> | |
234 | <a href="#">Reconnect</a> |
|
240 | <a href="#">Reconnect</a> | |
235 | </li> |
|
241 | </li> | |
236 | <li class="divider"></li> |
|
242 | <li class="divider"></li> | |
237 | <li id="menu-change-kernel" class="dropdown-submenu"> |
|
243 | <li id="menu-change-kernel" class="dropdown-submenu"> | |
238 | <a href="#">Change kernel</a> |
|
244 | <a href="#">Change kernel</a> | |
239 | <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul> |
|
245 | <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul> | |
240 | </li> |
|
246 | </li> | |
241 | </ul> |
|
247 | </ul> | |
242 | </li> |
|
248 | </li> | |
243 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> |
|
249 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> | |
244 | <ul id="help_menu" class="dropdown-menu"> |
|
250 | <ul id="help_menu" class="dropdown-menu"> | |
245 | <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li> |
|
251 | <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li> | |
246 | <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
252 | <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li> | |
247 | <li class="divider"></li> |
|
253 | <li class="divider"></li> | |
248 | {% set |
|
254 | {% set | |
249 | sections = ( |
|
255 | sections = ( | |
250 | ( |
|
256 | ( | |
251 | ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True), |
|
257 | ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True), | |
252 | ("https://help.github.com/articles/markdown-basics/","Markdown",True), |
|
258 | ("https://help.github.com/articles/markdown-basics/","Markdown",True), | |
253 | ), |
|
259 | ), | |
254 | ) |
|
260 | ) | |
255 | %} |
|
261 | %} | |
256 |
|
262 | |||
257 | {% for helplinks in sections %} |
|
263 | {% for helplinks in sections %} | |
258 | {% for link in helplinks %} |
|
264 | {% for link in helplinks %} | |
259 | <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}> |
|
265 | <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}> | |
260 | {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}} |
|
266 | {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}} | |
261 | {{link[1]}} |
|
267 | {{link[1]}} | |
262 | </a></li> |
|
268 | </a></li> | |
263 | {% endfor %} |
|
269 | {% endfor %} | |
264 | {% if not loop.last %} |
|
270 | {% if not loop.last %} | |
265 | <li class="divider"></li> |
|
271 | <li class="divider"></li> | |
266 | {% endif %} |
|
272 | {% endif %} | |
267 | {% endfor %} |
|
273 | {% endfor %} | |
268 | <li class="divider"></li> |
|
274 | <li class="divider"></li> | |
269 | <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li> |
|
275 | <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li> | |
270 | </ul> |
|
276 | </ul> | |
271 | </li> |
|
277 | </li> | |
272 | </ul> |
|
278 | </ul> | |
273 | </div> |
|
279 | </div> | |
274 | </div> |
|
280 | </div> | |
275 | </div> |
|
281 | </div> | |
276 | </div> |
|
282 | </div> | |
277 |
|
283 | |||
278 | <div id="maintoolbar" class="navbar"> |
|
284 | <div id="maintoolbar" class="navbar"> | |
279 | <div class="toolbar-inner navbar-inner navbar-nobg"> |
|
285 | <div class="toolbar-inner navbar-inner navbar-nobg"> | |
280 | <div id="maintoolbar-container" class="container"></div> |
|
286 | <div id="maintoolbar-container" class="container"></div> | |
281 | </div> |
|
287 | </div> | |
282 | </div> |
|
288 | </div> | |
283 | </div> |
|
289 | </div> | |
284 |
|
290 | |||
285 | <div class="lower-header-bar"></div> |
|
291 | <div class="lower-header-bar"></div> | |
286 | {% endblock header %} |
|
292 | {% endblock header %} | |
287 |
|
293 | |||
288 | {% block site %} |
|
294 | {% block site %} | |
289 |
|
295 | |||
290 | <div id="ipython-main-app"> |
|
296 | <div id="ipython-main-app"> | |
291 | <div id="notebook_panel"> |
|
297 | <div id="notebook_panel"> | |
292 | <div id="notebook"></div> |
|
298 | <div id="notebook"></div> | |
293 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> |
|
299 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> | |
294 | </div> |
|
300 | </div> | |
295 | </div> |
|
301 | </div> | |
296 |
|
302 | |||
297 |
|
303 | |||
298 | {% endblock %} |
|
304 | {% endblock %} | |
299 |
|
305 | |||
300 | {% block after_site %} |
|
306 | {% block after_site %} | |
301 |
|
307 | |||
302 | <div id="pager"> |
|
308 | <div id="pager"> | |
303 | <div id="pager-contents"> |
|
309 | <div id="pager-contents"> | |
304 | <div id="pager-container" class="container"></div> |
|
310 | <div id="pager-container" class="container"></div> | |
305 | </div> |
|
311 | </div> | |
306 | <div id='pager-button-area'></div> |
|
312 | <div id='pager-button-area'></div> | |
307 | </div> |
|
313 | </div> | |
308 |
|
314 | |||
309 | {% endblock %} |
|
315 | {% endblock %} | |
310 |
|
316 | |||
311 | {% block script %} |
|
317 | {% block script %} | |
312 | {{super()}} |
|
318 | {{super()}} | |
313 | <script type="text/javascript"> |
|
319 | <script type="text/javascript"> | |
314 | sys_info = {{sys_info}}; |
|
320 | sys_info = {{sys_info}}; | |
315 | </script> |
|
321 | </script> | |
316 |
|
322 | |||
317 | <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script> |
|
323 | <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script> | |
318 |
|
324 | |||
319 | <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script> |
|
325 | <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script> | |
320 |
|
326 | |||
321 | {% endblock %} |
|
327 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now