Show More
@@ -1,439 +1,445 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // CodeCell |
|
10 | 10 | //============================================================================ |
|
11 | 11 | /** |
|
12 | 12 | * An extendable module that provide base functionnality to create cell for notebook. |
|
13 | 13 | * @module IPython |
|
14 | 14 | * @namespace IPython |
|
15 | 15 | * @submodule CodeCell |
|
16 | 16 | */ |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | /* local util for codemirror */ |
|
20 | 20 | var posEq = function(a, b) {return a.line == b.line && a.ch == b.ch;} |
|
21 | 21 | |
|
22 | 22 | /** |
|
23 | 23 | * |
|
24 | 24 | * function to delete until previous non blanking space character |
|
25 | 25 | * or first multiple of 4 tabstop. |
|
26 | 26 | * @private |
|
27 | 27 | */ |
|
28 | 28 | CodeMirror.commands.delSpaceToPrevTabStop = function(cm){ |
|
29 | 29 | var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to); |
|
30 | 30 | if (!posEq(from, to)) {cm.replaceRange("", from, to); return} |
|
31 | 31 | var cur = cm.getCursor(), line = cm.getLine(cur.line); |
|
32 | 32 | var tabsize = cm.getOption('tabSize'); |
|
33 | 33 | var chToPrevTabStop = cur.ch-(Math.ceil(cur.ch/tabsize)-1)*tabsize; |
|
34 | 34 | var from = {ch:cur.ch-chToPrevTabStop,line:cur.line} |
|
35 | 35 | var select = cm.getRange(from,cur) |
|
36 | 36 | if( select.match(/^\ +$/) != null){ |
|
37 | 37 | cm.replaceRange("",from,cur) |
|
38 | 38 | } else { |
|
39 | 39 | cm.deleteH(-1,"char") |
|
40 | 40 | } |
|
41 | 41 | }; |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | var IPython = (function (IPython) { |
|
45 | 45 | "use strict"; |
|
46 | 46 | |
|
47 | 47 | var utils = IPython.utils; |
|
48 | 48 | var key = IPython.utils.keycodes; |
|
49 | 49 | |
|
50 | 50 | /** |
|
51 | 51 | * A Cell conceived to write code. |
|
52 | 52 | * |
|
53 | 53 | * The kernel doesn't have to be set at creation time, in that case |
|
54 | 54 | * it will be null and set_kernel has to be called later. |
|
55 | 55 | * @class CodeCell |
|
56 | 56 | * @extends IPython.Cell |
|
57 | 57 | * |
|
58 | 58 | * @constructor |
|
59 | 59 | * @param {Object|null} kernel |
|
60 | 60 | * @param {object|undefined} [options] |
|
61 | 61 | * @param [options.cm_config] {object} config to pass to CodeMirror |
|
62 | 62 | */ |
|
63 | 63 | var CodeCell = function (kernel, options) { |
|
64 | 64 | this.kernel = kernel || null; |
|
65 | 65 | this.code_mirror = null; |
|
66 | 66 | this.input_prompt_number = null; |
|
67 | 67 | this.collapsed = false; |
|
68 | 68 | this.default_mode = 'ipython'; |
|
69 | 69 | this.cell_type = "code"; |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | var cm_overwrite_options = { |
|
73 | 73 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) |
|
74 | 74 | }; |
|
75 | 75 | |
|
76 | 76 | options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options}); |
|
77 | 77 | |
|
78 | 78 | IPython.Cell.apply(this,[options]); |
|
79 | 79 | |
|
80 | 80 | var that = this; |
|
81 | 81 | this.element.focusout( |
|
82 | 82 | function() { that.auto_highlight(); } |
|
83 | 83 | ); |
|
84 | 84 | }; |
|
85 | 85 | |
|
86 | 86 | CodeCell.options_default = { |
|
87 | 87 | cm_config : { |
|
88 | extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess",'Backspace':"delSpaceToPrevTabStop"}, | |
|
88 | extraKeys: { | |
|
89 | "Tab" : "indentMore", | |
|
90 | "Shift-Tab" : "indentLess", | |
|
91 | "Backspace" : "delSpaceToPrevTabStop", | |
|
92 | "Cmd-/" : "toggleComment", | |
|
93 | "Ctrl-/" : "toggleComment" | |
|
94 | }, | |
|
89 | 95 | mode: 'ipython', |
|
90 | 96 | theme: 'ipython', |
|
91 | 97 | matchBrackets: true |
|
92 | 98 | } |
|
93 | 99 | }; |
|
94 | 100 | |
|
95 | 101 | |
|
96 | 102 | CodeCell.prototype = new IPython.Cell(); |
|
97 | 103 | |
|
98 | 104 | /** |
|
99 | 105 | * @method auto_highlight |
|
100 | 106 | */ |
|
101 | 107 | CodeCell.prototype.auto_highlight = function () { |
|
102 | 108 | this._auto_highlight(IPython.config.cell_magic_highlight) |
|
103 | 109 | }; |
|
104 | 110 | |
|
105 | 111 | /** @method create_element */ |
|
106 | 112 | CodeCell.prototype.create_element = function () { |
|
107 | 113 | IPython.Cell.prototype.create_element.apply(this, arguments); |
|
108 | 114 | |
|
109 | 115 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell'); |
|
110 | 116 | cell.attr('tabindex','2'); |
|
111 | 117 | |
|
112 | 118 | this.celltoolbar = new IPython.CellToolbar(this); |
|
113 | 119 | |
|
114 | 120 | var input = $('<div></div>').addClass('input'); |
|
115 | 121 | var vbox = $('<div/>').addClass('vbox box-flex1') |
|
116 | 122 | input.append($('<div/>').addClass('prompt input_prompt')); |
|
117 | 123 | vbox.append(this.celltoolbar.element); |
|
118 | 124 | var input_area = $('<div/>').addClass('input_area'); |
|
119 | 125 | this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); |
|
120 | 126 | $(this.code_mirror.getInputField()).attr("spellcheck", "false"); |
|
121 | 127 | vbox.append(input_area); |
|
122 | 128 | input.append(vbox); |
|
123 | 129 | var output = $('<div></div>'); |
|
124 | 130 | cell.append(input).append(output); |
|
125 | 131 | this.element = cell; |
|
126 | 132 | this.output_area = new IPython.OutputArea(output, true); |
|
127 | 133 | |
|
128 | 134 | // construct a completer only if class exist |
|
129 | 135 | // otherwise no print view |
|
130 | 136 | if (IPython.Completer !== undefined) |
|
131 | 137 | { |
|
132 | 138 | this.completer = new IPython.Completer(this); |
|
133 | 139 | } |
|
134 | 140 | }; |
|
135 | 141 | |
|
136 | 142 | /** |
|
137 | 143 | * This method gets called in CodeMirror's onKeyDown/onKeyPress |
|
138 | 144 | * handlers and is used to provide custom key handling. Its return |
|
139 | 145 | * value is used to determine if CodeMirror should ignore the event: |
|
140 | 146 | * true = ignore, false = don't ignore. |
|
141 | 147 | * @method handle_codemirror_keyevent |
|
142 | 148 | */ |
|
143 | 149 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { |
|
144 | 150 | |
|
145 | 151 | if (this.read_only){ |
|
146 | 152 | return false; |
|
147 | 153 | } |
|
148 | 154 | |
|
149 | 155 | var that = this; |
|
150 | 156 | // whatever key is pressed, first, cancel the tooltip request before |
|
151 | 157 | // they are sent, and remove tooltip if any, except for tab again |
|
152 | 158 | if (event.type === 'keydown' && event.which != key.TAB ) { |
|
153 | 159 | IPython.tooltip.remove_and_cancel_tooltip(); |
|
154 | 160 | }; |
|
155 | 161 | |
|
156 | 162 | var cur = editor.getCursor(); |
|
157 | 163 | if (event.keyCode === key.ENTER){ |
|
158 | 164 | this.auto_highlight(); |
|
159 | 165 | } |
|
160 | 166 | |
|
161 | 167 | if (event.keyCode === key.ENTER && (event.shiftKey || event.ctrlKey)) { |
|
162 | 168 | // Always ignore shift-enter in CodeMirror as we handle it. |
|
163 | 169 | return true; |
|
164 | 170 | } else if (event.which === 40 && event.type === 'keypress' && IPython.tooltip.time_before_tooltip >= 0) { |
|
165 | 171 | // triger on keypress (!) otherwise inconsistent event.which depending on plateform |
|
166 | 172 | // browser and keyboard layout ! |
|
167 | 173 | // Pressing '(' , request tooltip, don't forget to reappend it |
|
168 | 174 | IPython.tooltip.pending(that); |
|
169 | 175 | } else if (event.which === key.UPARROW && event.type === 'keydown') { |
|
170 | 176 | // If we are not at the top, let CM handle the up arrow and |
|
171 | 177 | // prevent the global keydown handler from handling it. |
|
172 | 178 | if (!that.at_top()) { |
|
173 | 179 | event.stop(); |
|
174 | 180 | return false; |
|
175 | 181 | } else { |
|
176 | 182 | return true; |
|
177 | 183 | }; |
|
178 | 184 | } else if (event.which === key.ESC) { |
|
179 | 185 | IPython.tooltip.remove_and_cancel_tooltip(true); |
|
180 | 186 | return true; |
|
181 | 187 | } else if (event.which === key.DOWNARROW && event.type === 'keydown') { |
|
182 | 188 | // If we are not at the bottom, let CM handle the down arrow and |
|
183 | 189 | // prevent the global keydown handler from handling it. |
|
184 | 190 | if (!that.at_bottom()) { |
|
185 | 191 | event.stop(); |
|
186 | 192 | return false; |
|
187 | 193 | } else { |
|
188 | 194 | return true; |
|
189 | 195 | }; |
|
190 | 196 | } else if (event.keyCode === key.TAB && event.type == 'keydown' && event.shiftKey) { |
|
191 | 197 | if (editor.somethingSelected()){ |
|
192 | 198 | var anchor = editor.getCursor("anchor"); |
|
193 | 199 | var head = editor.getCursor("head"); |
|
194 | 200 | if( anchor.line != head.line){ |
|
195 | 201 | return false; |
|
196 | 202 | } |
|
197 | 203 | } |
|
198 | 204 | IPython.tooltip.request(that); |
|
199 | 205 | event.stop(); |
|
200 | 206 | return true; |
|
201 | 207 | } else if (event.keyCode === key.TAB && event.type == 'keydown') { |
|
202 | 208 | // Tab completion. |
|
203 | 209 | //Do not trim here because of tooltip |
|
204 | 210 | if (editor.somethingSelected()){return false} |
|
205 | 211 | var pre_cursor = editor.getRange({line:cur.line,ch:0},cur); |
|
206 | 212 | if (pre_cursor.trim() === "") { |
|
207 | 213 | // Don't autocomplete if the part of the line before the cursor |
|
208 | 214 | // is empty. In this case, let CodeMirror handle indentation. |
|
209 | 215 | return false; |
|
210 | 216 | } else if ((pre_cursor.substr(-1) === "("|| pre_cursor.substr(-1) === " ") && IPython.config.tooltip_on_tab ) { |
|
211 | 217 | IPython.tooltip.request(that); |
|
212 | 218 | // Prevent the event from bubbling up. |
|
213 | 219 | event.stop(); |
|
214 | 220 | // Prevent CodeMirror from handling the tab. |
|
215 | 221 | return true; |
|
216 | 222 | } else { |
|
217 | 223 | event.stop(); |
|
218 | 224 | this.completer.startCompletion(); |
|
219 | 225 | return true; |
|
220 | 226 | }; |
|
221 | 227 | } else { |
|
222 | 228 | // keypress/keyup also trigger on TAB press, and we don't want to |
|
223 | 229 | // use those to disable tab completion. |
|
224 | 230 | return false; |
|
225 | 231 | }; |
|
226 | 232 | return false; |
|
227 | 233 | }; |
|
228 | 234 | |
|
229 | 235 | |
|
230 | 236 | // Kernel related calls. |
|
231 | 237 | |
|
232 | 238 | CodeCell.prototype.set_kernel = function (kernel) { |
|
233 | 239 | this.kernel = kernel; |
|
234 | 240 | } |
|
235 | 241 | |
|
236 | 242 | /** |
|
237 | 243 | * Execute current code cell to the kernel |
|
238 | 244 | * @method execute |
|
239 | 245 | */ |
|
240 | 246 | CodeCell.prototype.execute = function () { |
|
241 | 247 | this.output_area.clear_output(true, true, true); |
|
242 | 248 | this.set_input_prompt('*'); |
|
243 | 249 | this.element.addClass("running"); |
|
244 | 250 | var callbacks = { |
|
245 | 251 | 'execute_reply': $.proxy(this._handle_execute_reply, this), |
|
246 | 252 | 'output': $.proxy(this.output_area.handle_output, this.output_area), |
|
247 | 253 | 'clear_output': $.proxy(this.output_area.handle_clear_output, this.output_area), |
|
248 | 254 | 'set_next_input': $.proxy(this._handle_set_next_input, this), |
|
249 | 255 | 'input_request': $.proxy(this._handle_input_request, this) |
|
250 | 256 | }; |
|
251 | 257 | var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false}); |
|
252 | 258 | }; |
|
253 | 259 | |
|
254 | 260 | /** |
|
255 | 261 | * @method _handle_execute_reply |
|
256 | 262 | * @private |
|
257 | 263 | */ |
|
258 | 264 | CodeCell.prototype._handle_execute_reply = function (content) { |
|
259 | 265 | this.set_input_prompt(content.execution_count); |
|
260 | 266 | this.element.removeClass("running"); |
|
261 | 267 | $([IPython.events]).trigger('set_dirty.Notebook', {value: true}); |
|
262 | 268 | } |
|
263 | 269 | |
|
264 | 270 | /** |
|
265 | 271 | * @method _handle_set_next_input |
|
266 | 272 | * @private |
|
267 | 273 | */ |
|
268 | 274 | CodeCell.prototype._handle_set_next_input = function (text) { |
|
269 | 275 | var data = {'cell': this, 'text': text} |
|
270 | 276 | $([IPython.events]).trigger('set_next_input.Notebook', data); |
|
271 | 277 | } |
|
272 | 278 | |
|
273 | 279 | /** |
|
274 | 280 | * @method _handle_input_request |
|
275 | 281 | * @private |
|
276 | 282 | */ |
|
277 | 283 | CodeCell.prototype._handle_input_request = function (content) { |
|
278 | 284 | this.output_area.append_raw_input(content); |
|
279 | 285 | } |
|
280 | 286 | |
|
281 | 287 | |
|
282 | 288 | // Basic cell manipulation. |
|
283 | 289 | |
|
284 | 290 | CodeCell.prototype.select = function () { |
|
285 | 291 | IPython.Cell.prototype.select.apply(this); |
|
286 | 292 | this.code_mirror.refresh(); |
|
287 | 293 | this.code_mirror.focus(); |
|
288 | 294 | this.auto_highlight(); |
|
289 | 295 | // We used to need an additional refresh() after the focus, but |
|
290 | 296 | // it appears that this has been fixed in CM. This bug would show |
|
291 | 297 | // up on FF when a newly loaded markdown cell was edited. |
|
292 | 298 | }; |
|
293 | 299 | |
|
294 | 300 | |
|
295 | 301 | CodeCell.prototype.select_all = function () { |
|
296 | 302 | var start = {line: 0, ch: 0}; |
|
297 | 303 | var nlines = this.code_mirror.lineCount(); |
|
298 | 304 | var last_line = this.code_mirror.getLine(nlines-1); |
|
299 | 305 | var end = {line: nlines-1, ch: last_line.length}; |
|
300 | 306 | this.code_mirror.setSelection(start, end); |
|
301 | 307 | }; |
|
302 | 308 | |
|
303 | 309 | |
|
304 | 310 | CodeCell.prototype.collapse = function () { |
|
305 | 311 | this.collapsed = true; |
|
306 | 312 | this.output_area.collapse(); |
|
307 | 313 | }; |
|
308 | 314 | |
|
309 | 315 | |
|
310 | 316 | CodeCell.prototype.expand = function () { |
|
311 | 317 | this.collapsed = false; |
|
312 | 318 | this.output_area.expand(); |
|
313 | 319 | }; |
|
314 | 320 | |
|
315 | 321 | |
|
316 | 322 | CodeCell.prototype.toggle_output = function () { |
|
317 | 323 | this.collapsed = Boolean(1 - this.collapsed); |
|
318 | 324 | this.output_area.toggle_output(); |
|
319 | 325 | }; |
|
320 | 326 | |
|
321 | 327 | |
|
322 | 328 | CodeCell.prototype.toggle_output_scroll = function () { |
|
323 | 329 | this.output_area.toggle_scroll(); |
|
324 | 330 | }; |
|
325 | 331 | |
|
326 | 332 | |
|
327 | 333 | CodeCell.input_prompt_classical = function (prompt_value, lines_number) { |
|
328 | 334 | var ns = prompt_value || " "; |
|
329 | 335 | return 'In [' + ns + ']:' |
|
330 | 336 | }; |
|
331 | 337 | |
|
332 | 338 | CodeCell.input_prompt_continuation = function (prompt_value, lines_number) { |
|
333 | 339 | var html = [CodeCell.input_prompt_classical(prompt_value, lines_number)]; |
|
334 | 340 | for(var i=1; i < lines_number; i++){html.push(['...:'])}; |
|
335 | 341 | return html.join('</br>') |
|
336 | 342 | }; |
|
337 | 343 | |
|
338 | 344 | CodeCell.input_prompt_function = CodeCell.input_prompt_classical; |
|
339 | 345 | |
|
340 | 346 | |
|
341 | 347 | CodeCell.prototype.set_input_prompt = function (number) { |
|
342 | 348 | var nline = 1 |
|
343 | 349 | if( this.code_mirror != undefined) { |
|
344 | 350 | nline = this.code_mirror.lineCount(); |
|
345 | 351 | } |
|
346 | 352 | this.input_prompt_number = number; |
|
347 | 353 | var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline); |
|
348 | 354 | this.element.find('div.input_prompt').html(prompt_html); |
|
349 | 355 | }; |
|
350 | 356 | |
|
351 | 357 | |
|
352 | 358 | CodeCell.prototype.clear_input = function () { |
|
353 | 359 | this.code_mirror.setValue(''); |
|
354 | 360 | }; |
|
355 | 361 | |
|
356 | 362 | |
|
357 | 363 | CodeCell.prototype.get_text = function () { |
|
358 | 364 | return this.code_mirror.getValue(); |
|
359 | 365 | }; |
|
360 | 366 | |
|
361 | 367 | |
|
362 | 368 | CodeCell.prototype.set_text = function (code) { |
|
363 | 369 | return this.code_mirror.setValue(code); |
|
364 | 370 | }; |
|
365 | 371 | |
|
366 | 372 | |
|
367 | 373 | CodeCell.prototype.at_top = function () { |
|
368 | 374 | var cursor = this.code_mirror.getCursor(); |
|
369 | 375 | if (cursor.line === 0 && cursor.ch === 0) { |
|
370 | 376 | return true; |
|
371 | 377 | } else { |
|
372 | 378 | return false; |
|
373 | 379 | } |
|
374 | 380 | }; |
|
375 | 381 | |
|
376 | 382 | |
|
377 | 383 | CodeCell.prototype.at_bottom = function () { |
|
378 | 384 | var cursor = this.code_mirror.getCursor(); |
|
379 | 385 | if (cursor.line === (this.code_mirror.lineCount()-1) && cursor.ch === this.code_mirror.getLine(cursor.line).length) { |
|
380 | 386 | return true; |
|
381 | 387 | } else { |
|
382 | 388 | return false; |
|
383 | 389 | } |
|
384 | 390 | }; |
|
385 | 391 | |
|
386 | 392 | |
|
387 | 393 | CodeCell.prototype.clear_output = function (stdout, stderr, other) { |
|
388 | 394 | this.output_area.clear_output(stdout, stderr, other); |
|
389 | 395 | }; |
|
390 | 396 | |
|
391 | 397 | |
|
392 | 398 | // JSON serialization |
|
393 | 399 | |
|
394 | 400 | CodeCell.prototype.fromJSON = function (data) { |
|
395 | 401 | IPython.Cell.prototype.fromJSON.apply(this, arguments); |
|
396 | 402 | if (data.cell_type === 'code') { |
|
397 | 403 | if (data.input !== undefined) { |
|
398 | 404 | this.set_text(data.input); |
|
399 | 405 | // make this value the starting point, so that we can only undo |
|
400 | 406 | // to this state, instead of a blank cell |
|
401 | 407 | this.code_mirror.clearHistory(); |
|
402 | 408 | this.auto_highlight(); |
|
403 | 409 | } |
|
404 | 410 | if (data.prompt_number !== undefined) { |
|
405 | 411 | this.set_input_prompt(data.prompt_number); |
|
406 | 412 | } else { |
|
407 | 413 | this.set_input_prompt(); |
|
408 | 414 | }; |
|
409 | 415 | this.output_area.fromJSON(data.outputs); |
|
410 | 416 | if (data.collapsed !== undefined) { |
|
411 | 417 | if (data.collapsed) { |
|
412 | 418 | this.collapse(); |
|
413 | 419 | } else { |
|
414 | 420 | this.expand(); |
|
415 | 421 | }; |
|
416 | 422 | }; |
|
417 | 423 | }; |
|
418 | 424 | }; |
|
419 | 425 | |
|
420 | 426 | |
|
421 | 427 | CodeCell.prototype.toJSON = function () { |
|
422 | 428 | var data = IPython.Cell.prototype.toJSON.apply(this); |
|
423 | 429 | data.input = this.get_text(); |
|
424 | 430 | data.cell_type = 'code'; |
|
425 | 431 | if (this.input_prompt_number) { |
|
426 | 432 | data.prompt_number = this.input_prompt_number; |
|
427 | 433 | }; |
|
428 | 434 | var outputs = this.output_area.toJSON(); |
|
429 | 435 | data.outputs = outputs; |
|
430 | 436 | data.language = 'python'; |
|
431 | 437 | data.collapsed = this.collapsed; |
|
432 | 438 | return data; |
|
433 | 439 | }; |
|
434 | 440 | |
|
435 | 441 | |
|
436 | 442 | IPython.CodeCell = CodeCell; |
|
437 | 443 | |
|
438 | 444 | return IPython; |
|
439 | 445 | }(IPython)); |
@@ -1,257 +1,258 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/codemirror/lib/codemirror.css") }}"> |
|
15 | 15 | |
|
16 | 16 | {{super()}} |
|
17 | 17 | |
|
18 | 18 | <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" /> |
|
19 | 19 | |
|
20 | 20 | {% endblock %} |
|
21 | 21 | |
|
22 | 22 | {% block params %} |
|
23 | 23 | |
|
24 | 24 | data-project={{project}} |
|
25 | 25 | data-base-project-url={{base_project_url}} |
|
26 | 26 | data-base-kernel-url={{base_kernel_url}} |
|
27 | 27 | data-read-only={{read_only and not logged_in}} |
|
28 | 28 | data-notebook-id={{notebook_id}} |
|
29 | 29 | class="notebook_app" |
|
30 | 30 | |
|
31 | 31 | {% endblock %} |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | {% block header %} |
|
35 | 35 | |
|
36 | 36 | <span id="save_widget" class="nav pull-left"> |
|
37 | 37 | <span id="notebook_name"></span> |
|
38 | 38 | <span id="checkpoint_status"></span> |
|
39 | 39 | <span id="autosave_status"></span> |
|
40 | 40 | </span> |
|
41 | 41 | |
|
42 | 42 | {% endblock %} |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | {% block site %} |
|
46 | 46 | |
|
47 | 47 | <div id="menubar-container" class="container"> |
|
48 | 48 | <div id="menubar"> |
|
49 | 49 | <div class="navbar"> |
|
50 | 50 | <div class="navbar-inner"> |
|
51 | 51 | <div class="container"> |
|
52 | 52 | <ul id="menus" class="nav"> |
|
53 | 53 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a> |
|
54 | 54 | <ul class="dropdown-menu"> |
|
55 | 55 | <li id="new_notebook"><a href="#">New</a></li> |
|
56 | 56 | <li id="open_notebook"><a href="#">Open...</a></li> |
|
57 | 57 | <!-- <hr/> --> |
|
58 | 58 | <li class="divider"></li> |
|
59 | 59 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> |
|
60 | 60 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
61 | 61 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> |
|
62 | 62 | <!-- <hr/> --> |
|
63 | 63 | <li class="divider"></li> |
|
64 | 64 | <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a> |
|
65 | 65 | <ul class="dropdown-menu"> |
|
66 | 66 | <li><a href="#"></a></li> |
|
67 | 67 | <li><a href="#"></a></li> |
|
68 | 68 | <li><a href="#"></a></li> |
|
69 | 69 | <li><a href="#"></a></li> |
|
70 | 70 | <li><a href="#"></a></li> |
|
71 | 71 | </ul> |
|
72 | 72 | </li> |
|
73 | 73 | <li class="divider"></li> |
|
74 | 74 | <li class="dropdown-submenu"><a href="#">Download as</a> |
|
75 | 75 | <ul class="dropdown-menu"> |
|
76 | 76 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
|
77 | 77 | <li id="download_py"><a href="#">Python (.py)</a></li> |
|
78 | 78 | </ul> |
|
79 | 79 | </li> |
|
80 | 80 | <li class="divider"></li> |
|
81 | 81 | |
|
82 | 82 | <li id="kill_and_exit"><a href="#" >Close and halt</a></li> |
|
83 | 83 | </ul> |
|
84 | 84 | </li> |
|
85 | 85 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
|
86 | 86 | <ul class="dropdown-menu"> |
|
87 | 87 | <li id="cut_cell"><a href="#">Cut Cell</a></li> |
|
88 | 88 | <li id="copy_cell"><a href="#">Copy Cell</a></li> |
|
89 | 89 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> |
|
90 | 90 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> |
|
91 | 91 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> |
|
92 | 92 | <li id="delete_cell"><a href="#">Delete Cell</a></li> |
|
93 | 93 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> |
|
94 | 94 | <li class="divider"></li> |
|
95 | 95 | <li id="split_cell"><a href="#">Split Cell</a></li> |
|
96 | 96 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> |
|
97 | 97 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> |
|
98 | 98 | <li class="divider"></li> |
|
99 | 99 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> |
|
100 | 100 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
101 | 101 | <li class="divider"></li> |
|
102 | 102 | <li id="select_previous"><a href="#">Select Previous Cell</a></li> |
|
103 | 103 | <li id="select_next"><a href="#">Select Next Cell</a></li> |
|
104 | 104 | </ul> |
|
105 | 105 | </li> |
|
106 | 106 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> |
|
107 | 107 | <ul class="dropdown-menu"> |
|
108 | 108 | <li id="toggle_header"><a href="#">Toggle Header</a></li> |
|
109 | 109 | <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li> |
|
110 | 110 | </ul> |
|
111 | 111 | </li> |
|
112 | 112 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> |
|
113 | 113 | <ul class="dropdown-menu"> |
|
114 | 114 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> |
|
115 | 115 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> |
|
116 | 116 | </ul> |
|
117 | 117 | </li> |
|
118 | 118 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> |
|
119 | 119 | <ul class="dropdown-menu"> |
|
120 | 120 | <li id="run_cell"><a href="#">Run</a></li> |
|
121 | 121 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> |
|
122 | 122 | <li id="run_all_cells"><a href="#">Run All</a></li> |
|
123 | 123 | <li id="run_all_cells_above"><a href="#">Run All Above</a></li> |
|
124 | 124 | <li id="run_all_cells_below"><a href="#">Run All Below</a></li> |
|
125 | 125 | <li class="divider"></li> |
|
126 | 126 | <li id="change_cell_type" class="dropdown-submenu"><a href="#">Cell Type</a> |
|
127 | 127 | <ul class="dropdown-menu"> |
|
128 | 128 | <li id="to_code"><a href="#">Code</a></li> |
|
129 | 129 | <li id="to_markdown"><a href="#">Markdown </a></li> |
|
130 | 130 | <li id="to_raw"><a href="#">Raw Text</a></li> |
|
131 | 131 | <li id="to_heading1"><a href="#">Heading 1</a></li> |
|
132 | 132 | <li id="to_heading2"><a href="#">Heading 2</a></li> |
|
133 | 133 | <li id="to_heading3"><a href="#">Heading 3</a></li> |
|
134 | 134 | <li id="to_heading4"><a href="#">Heading 4</a></li> |
|
135 | 135 | <li id="to_heading5"><a href="#">Heading 5</a></li> |
|
136 | 136 | <li id="to_heading6"><a href="#">Heading 6</a></li> |
|
137 | 137 | </ul> |
|
138 | 138 | </li> |
|
139 | 139 | <li class="divider"></li> |
|
140 | 140 | <li id="toggle_output"><a href="#">Toggle Current Output</a></li> |
|
141 | 141 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> |
|
142 | 142 | <ul class="dropdown-menu"> |
|
143 | 143 | <li id="expand_all_output"><a href="#">Expand</a></li> |
|
144 | 144 | <li id="scroll_all_output"><a href="#">Scroll Long</a></li> |
|
145 | 145 | <li id="collapse_all_output"><a href="#">Collapse</a></li> |
|
146 | 146 | <li id="clear_all_output"><a href="#">Clear</a></li> |
|
147 | 147 | </ul> |
|
148 | 148 | </li> |
|
149 | 149 | </ul> |
|
150 | 150 | </li> |
|
151 | 151 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> |
|
152 | 152 | <ul class="dropdown-menu"> |
|
153 | 153 | <li id="int_kernel"><a href="#">Interrupt</a></li> |
|
154 | 154 | <li id="restart_kernel"><a href="#">Restart</a></li> |
|
155 | 155 | </ul> |
|
156 | 156 | </li> |
|
157 | 157 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> |
|
158 | 158 | <ul class="dropdown-menu"> |
|
159 | 159 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> |
|
160 | 160 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> |
|
161 | 161 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
162 | 162 | <li class="divider"></li> |
|
163 | 163 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> |
|
164 | 164 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
|
165 | 165 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> |
|
166 | 166 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> |
|
167 | 167 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> |
|
168 | 168 | </ul> |
|
169 | 169 | </li> |
|
170 | 170 | </ul> |
|
171 | 171 | <div id="notification_area"></div> |
|
172 | 172 | </div> |
|
173 | 173 | </div> |
|
174 | 174 | </div> |
|
175 | 175 | </div> |
|
176 | 176 | <div id="maintoolbar" class="navbar"> |
|
177 | 177 | <div class="toolbar-inner navbar-inner navbar-nobg"> |
|
178 | 178 | <div id="maintoolbar-container" class="container"></div> |
|
179 | 179 | </div> |
|
180 | 180 | </div> |
|
181 | 181 | </div> |
|
182 | 182 | |
|
183 | 183 | <div id="ipython-main-app"> |
|
184 | 184 | |
|
185 | 185 | <div id="notebook_panel"> |
|
186 | 186 | <div id="notebook"></div> |
|
187 | 187 | <div id="pager_splitter"></div> |
|
188 | 188 | <div id="pager"> |
|
189 | 189 | <div id='pager_button_area'> |
|
190 | 190 | </div> |
|
191 | 191 | <div id="pager-container" class="container"></div> |
|
192 | 192 | </div> |
|
193 | 193 | </div> |
|
194 | 194 | |
|
195 | 195 | </div> |
|
196 | 196 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | {% endblock %} |
|
200 | 200 | |
|
201 | 201 | |
|
202 | 202 | {% block script %} |
|
203 | 203 | |
|
204 | 204 | {{super()}} |
|
205 | 205 | |
|
206 | 206 | <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script> |
|
207 | 207 | <script type="text/javascript"> |
|
208 | 208 | CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js") }}"; |
|
209 | 209 | </script> |
|
210 | 210 | <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script> |
|
211 | 211 | <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script> |
|
212 | 212 | <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script> |
|
213 | 213 | <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script> |
|
214 | <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script> | |
|
214 | 215 | <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script> |
|
215 | 216 | <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script> |
|
216 | 217 | <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script> |
|
217 | 218 | <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script> |
|
218 | 219 | <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script> |
|
219 | 220 | <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script> |
|
220 | 221 | <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script> |
|
221 | 222 | <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script> |
|
222 | 223 | |
|
223 | 224 | <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script> |
|
224 | 225 | |
|
225 | 226 | <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script> |
|
226 | 227 | |
|
227 | 228 | <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script> |
|
228 | 229 | <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
229 | 230 | <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script> |
|
230 | 231 | <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
231 | 232 | <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
232 | 233 | <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
233 | 234 | <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
234 | 235 | <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
235 | 236 | <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
236 | 237 | <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script> |
|
237 | 238 | <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
238 | 239 | <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script> |
|
239 | 240 | <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
240 | 241 | <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script> |
|
241 | 242 | <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
242 | 243 | <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
243 | 244 | <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
244 | 245 | <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
245 | 246 | <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> |
|
246 | 247 | <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
247 | 248 | <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
248 | 249 | <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> |
|
249 | 250 | <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script> |
|
250 | 251 | <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script> |
|
251 | 252 | |
|
252 | 253 | <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script> |
|
253 | 254 | |
|
254 | 255 | <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script> |
|
255 | 256 | <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script> |
|
256 | 257 | |
|
257 | 258 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now