Show More
@@ -1,440 +1,439 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 | CodeMirror.modeURL = "/static/components/codemirror/mode/%N/%N.js"; | |
|
50 | 49 | |
|
51 | 50 | /** |
|
52 | 51 | * A Cell conceived to write code. |
|
53 | 52 | * |
|
54 | 53 | * The kernel doesn't have to be set at creation time, in that case |
|
55 | 54 | * it will be null and set_kernel has to be called later. |
|
56 | 55 | * @class CodeCell |
|
57 | 56 | * @extends IPython.Cell |
|
58 | 57 | * |
|
59 | 58 | * @constructor |
|
60 | 59 | * @param {Object|null} kernel |
|
61 | 60 | * @param {object|undefined} [options] |
|
62 | 61 | * @param [options.cm_config] {object} config to pass to CodeMirror |
|
63 | 62 | */ |
|
64 | 63 | var CodeCell = function (kernel, options) { |
|
65 | 64 | this.kernel = kernel || null; |
|
66 | 65 | this.code_mirror = null; |
|
67 | 66 | this.input_prompt_number = null; |
|
68 | 67 | this.collapsed = false; |
|
69 | 68 | this.default_mode = 'ipython'; |
|
70 | 69 | this.cell_type = "code"; |
|
71 | 70 | |
|
72 | 71 | |
|
73 | 72 | var cm_overwrite_options = { |
|
74 | 73 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) |
|
75 | 74 | }; |
|
76 | 75 | |
|
77 | 76 | options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options}); |
|
78 | 77 | |
|
79 | 78 | IPython.Cell.apply(this,[options]); |
|
80 | 79 | |
|
81 | 80 | var that = this; |
|
82 | 81 | this.element.focusout( |
|
83 | 82 | function() { that.auto_highlight(); } |
|
84 | 83 | ); |
|
85 | 84 | }; |
|
86 | 85 | |
|
87 | 86 | CodeCell.options_default = { |
|
88 | 87 | cm_config : { |
|
89 | 88 | extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess",'Backspace':"delSpaceToPrevTabStop"}, |
|
90 | 89 | mode: 'ipython', |
|
91 | 90 | theme: 'ipython', |
|
92 | 91 | matchBrackets: true |
|
93 | 92 | } |
|
94 | 93 | }; |
|
95 | 94 | |
|
96 | 95 | |
|
97 | 96 | CodeCell.prototype = new IPython.Cell(); |
|
98 | 97 | |
|
99 | 98 | /** |
|
100 | 99 | * @method auto_highlight |
|
101 | 100 | */ |
|
102 | 101 | CodeCell.prototype.auto_highlight = function () { |
|
103 | 102 | this._auto_highlight(IPython.config.cell_magic_highlight) |
|
104 | 103 | }; |
|
105 | 104 | |
|
106 | 105 | /** @method create_element */ |
|
107 | 106 | CodeCell.prototype.create_element = function () { |
|
108 | 107 | IPython.Cell.prototype.create_element.apply(this, arguments); |
|
109 | 108 | |
|
110 | 109 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell'); |
|
111 | 110 | cell.attr('tabindex','2'); |
|
112 | 111 | |
|
113 | 112 | this.celltoolbar = new IPython.CellToolbar(this); |
|
114 | 113 | |
|
115 | 114 | var input = $('<div></div>').addClass('input'); |
|
116 | 115 | var vbox = $('<div/>').addClass('vbox box-flex1') |
|
117 | 116 | input.append($('<div/>').addClass('prompt input_prompt')); |
|
118 | 117 | vbox.append(this.celltoolbar.element); |
|
119 | 118 | var input_area = $('<div/>').addClass('input_area'); |
|
120 | 119 | this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); |
|
121 | 120 | $(this.code_mirror.getInputField()).attr("spellcheck", "false"); |
|
122 | 121 | vbox.append(input_area); |
|
123 | 122 | input.append(vbox); |
|
124 | 123 | var output = $('<div></div>'); |
|
125 | 124 | cell.append(input).append(output); |
|
126 | 125 | this.element = cell; |
|
127 | 126 | this.output_area = new IPython.OutputArea(output, true); |
|
128 | 127 | |
|
129 | 128 | // construct a completer only if class exist |
|
130 | 129 | // otherwise no print view |
|
131 | 130 | if (IPython.Completer !== undefined) |
|
132 | 131 | { |
|
133 | 132 | this.completer = new IPython.Completer(this); |
|
134 | 133 | } |
|
135 | 134 | }; |
|
136 | 135 | |
|
137 | 136 | /** |
|
138 | 137 | * This method gets called in CodeMirror's onKeyDown/onKeyPress |
|
139 | 138 | * handlers and is used to provide custom key handling. Its return |
|
140 | 139 | * value is used to determine if CodeMirror should ignore the event: |
|
141 | 140 | * true = ignore, false = don't ignore. |
|
142 | 141 | * @method handle_codemirror_keyevent |
|
143 | 142 | */ |
|
144 | 143 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { |
|
145 | 144 | |
|
146 | 145 | if (this.read_only){ |
|
147 | 146 | return false; |
|
148 | 147 | } |
|
149 | 148 | |
|
150 | 149 | var that = this; |
|
151 | 150 | // whatever key is pressed, first, cancel the tooltip request before |
|
152 | 151 | // they are sent, and remove tooltip if any, except for tab again |
|
153 | 152 | if (event.type === 'keydown' && event.which != key.TAB ) { |
|
154 | 153 | IPython.tooltip.remove_and_cancel_tooltip(); |
|
155 | 154 | }; |
|
156 | 155 | |
|
157 | 156 | var cur = editor.getCursor(); |
|
158 | 157 | if (event.keyCode === key.ENTER){ |
|
159 | 158 | this.auto_highlight(); |
|
160 | 159 | } |
|
161 | 160 | |
|
162 | 161 | if (event.keyCode === key.ENTER && (event.shiftKey || event.ctrlKey)) { |
|
163 | 162 | // Always ignore shift-enter in CodeMirror as we handle it. |
|
164 | 163 | return true; |
|
165 | 164 | } else if (event.which === 40 && event.type === 'keypress' && IPython.tooltip.time_before_tooltip >= 0) { |
|
166 | 165 | // triger on keypress (!) otherwise inconsistent event.which depending on plateform |
|
167 | 166 | // browser and keyboard layout ! |
|
168 | 167 | // Pressing '(' , request tooltip, don't forget to reappend it |
|
169 | 168 | IPython.tooltip.pending(that); |
|
170 | 169 | } else if (event.which === key.UPARROW && event.type === 'keydown') { |
|
171 | 170 | // If we are not at the top, let CM handle the up arrow and |
|
172 | 171 | // prevent the global keydown handler from handling it. |
|
173 | 172 | if (!that.at_top()) { |
|
174 | 173 | event.stop(); |
|
175 | 174 | return false; |
|
176 | 175 | } else { |
|
177 | 176 | return true; |
|
178 | 177 | }; |
|
179 | 178 | } else if (event.which === key.ESC) { |
|
180 | 179 | IPython.tooltip.remove_and_cancel_tooltip(true); |
|
181 | 180 | return true; |
|
182 | 181 | } else if (event.which === key.DOWNARROW && event.type === 'keydown') { |
|
183 | 182 | // If we are not at the bottom, let CM handle the down arrow and |
|
184 | 183 | // prevent the global keydown handler from handling it. |
|
185 | 184 | if (!that.at_bottom()) { |
|
186 | 185 | event.stop(); |
|
187 | 186 | return false; |
|
188 | 187 | } else { |
|
189 | 188 | return true; |
|
190 | 189 | }; |
|
191 | 190 | } else if (event.keyCode === key.TAB && event.type == 'keydown' && event.shiftKey) { |
|
192 | 191 | if (editor.somethingSelected()){ |
|
193 | 192 | var anchor = editor.getCursor("anchor"); |
|
194 | 193 | var head = editor.getCursor("head"); |
|
195 | 194 | if( anchor.line != head.line){ |
|
196 | 195 | return false; |
|
197 | 196 | } |
|
198 | 197 | } |
|
199 | 198 | IPython.tooltip.request(that); |
|
200 | 199 | event.stop(); |
|
201 | 200 | return true; |
|
202 | 201 | } else if (event.keyCode === key.TAB && event.type == 'keydown') { |
|
203 | 202 | // Tab completion. |
|
204 | 203 | //Do not trim here because of tooltip |
|
205 | 204 | if (editor.somethingSelected()){return false} |
|
206 | 205 | var pre_cursor = editor.getRange({line:cur.line,ch:0},cur); |
|
207 | 206 | if (pre_cursor.trim() === "") { |
|
208 | 207 | // Don't autocomplete if the part of the line before the cursor |
|
209 | 208 | // is empty. In this case, let CodeMirror handle indentation. |
|
210 | 209 | return false; |
|
211 | 210 | } else if ((pre_cursor.substr(-1) === "("|| pre_cursor.substr(-1) === " ") && IPython.config.tooltip_on_tab ) { |
|
212 | 211 | IPython.tooltip.request(that); |
|
213 | 212 | // Prevent the event from bubbling up. |
|
214 | 213 | event.stop(); |
|
215 | 214 | // Prevent CodeMirror from handling the tab. |
|
216 | 215 | return true; |
|
217 | 216 | } else { |
|
218 | 217 | event.stop(); |
|
219 | 218 | this.completer.startCompletion(); |
|
220 | 219 | return true; |
|
221 | 220 | }; |
|
222 | 221 | } else { |
|
223 | 222 | // keypress/keyup also trigger on TAB press, and we don't want to |
|
224 | 223 | // use those to disable tab completion. |
|
225 | 224 | return false; |
|
226 | 225 | }; |
|
227 | 226 | return false; |
|
228 | 227 | }; |
|
229 | 228 | |
|
230 | 229 | |
|
231 | 230 | // Kernel related calls. |
|
232 | 231 | |
|
233 | 232 | CodeCell.prototype.set_kernel = function (kernel) { |
|
234 | 233 | this.kernel = kernel; |
|
235 | 234 | } |
|
236 | 235 | |
|
237 | 236 | /** |
|
238 | 237 | * Execute current code cell to the kernel |
|
239 | 238 | * @method execute |
|
240 | 239 | */ |
|
241 | 240 | CodeCell.prototype.execute = function () { |
|
242 | 241 | this.output_area.clear_output(true, true, true); |
|
243 | 242 | this.set_input_prompt('*'); |
|
244 | 243 | this.element.addClass("running"); |
|
245 | 244 | var callbacks = { |
|
246 | 245 | 'execute_reply': $.proxy(this._handle_execute_reply, this), |
|
247 | 246 | 'output': $.proxy(this.output_area.handle_output, this.output_area), |
|
248 | 247 | 'clear_output': $.proxy(this.output_area.handle_clear_output, this.output_area), |
|
249 | 248 | 'set_next_input': $.proxy(this._handle_set_next_input, this), |
|
250 | 249 | 'input_request': $.proxy(this._handle_input_request, this) |
|
251 | 250 | }; |
|
252 | 251 | var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false}); |
|
253 | 252 | }; |
|
254 | 253 | |
|
255 | 254 | /** |
|
256 | 255 | * @method _handle_execute_reply |
|
257 | 256 | * @private |
|
258 | 257 | */ |
|
259 | 258 | CodeCell.prototype._handle_execute_reply = function (content) { |
|
260 | 259 | this.set_input_prompt(content.execution_count); |
|
261 | 260 | this.element.removeClass("running"); |
|
262 | 261 | $([IPython.events]).trigger('set_dirty.Notebook', {value: true}); |
|
263 | 262 | } |
|
264 | 263 | |
|
265 | 264 | /** |
|
266 | 265 | * @method _handle_set_next_input |
|
267 | 266 | * @private |
|
268 | 267 | */ |
|
269 | 268 | CodeCell.prototype._handle_set_next_input = function (text) { |
|
270 | 269 | var data = {'cell': this, 'text': text} |
|
271 | 270 | $([IPython.events]).trigger('set_next_input.Notebook', data); |
|
272 | 271 | } |
|
273 | 272 | |
|
274 | 273 | /** |
|
275 | 274 | * @method _handle_input_request |
|
276 | 275 | * @private |
|
277 | 276 | */ |
|
278 | 277 | CodeCell.prototype._handle_input_request = function (content) { |
|
279 | 278 | this.output_area.append_raw_input(content); |
|
280 | 279 | } |
|
281 | 280 | |
|
282 | 281 | |
|
283 | 282 | // Basic cell manipulation. |
|
284 | 283 | |
|
285 | 284 | CodeCell.prototype.select = function () { |
|
286 | 285 | IPython.Cell.prototype.select.apply(this); |
|
287 | 286 | this.code_mirror.refresh(); |
|
288 | 287 | this.code_mirror.focus(); |
|
289 | 288 | this.auto_highlight(); |
|
290 | 289 | // We used to need an additional refresh() after the focus, but |
|
291 | 290 | // it appears that this has been fixed in CM. This bug would show |
|
292 | 291 | // up on FF when a newly loaded markdown cell was edited. |
|
293 | 292 | }; |
|
294 | 293 | |
|
295 | 294 | |
|
296 | 295 | CodeCell.prototype.select_all = function () { |
|
297 | 296 | var start = {line: 0, ch: 0}; |
|
298 | 297 | var nlines = this.code_mirror.lineCount(); |
|
299 | 298 | var last_line = this.code_mirror.getLine(nlines-1); |
|
300 | 299 | var end = {line: nlines-1, ch: last_line.length}; |
|
301 | 300 | this.code_mirror.setSelection(start, end); |
|
302 | 301 | }; |
|
303 | 302 | |
|
304 | 303 | |
|
305 | 304 | CodeCell.prototype.collapse = function () { |
|
306 | 305 | this.collapsed = true; |
|
307 | 306 | this.output_area.collapse(); |
|
308 | 307 | }; |
|
309 | 308 | |
|
310 | 309 | |
|
311 | 310 | CodeCell.prototype.expand = function () { |
|
312 | 311 | this.collapsed = false; |
|
313 | 312 | this.output_area.expand(); |
|
314 | 313 | }; |
|
315 | 314 | |
|
316 | 315 | |
|
317 | 316 | CodeCell.prototype.toggle_output = function () { |
|
318 | 317 | this.collapsed = Boolean(1 - this.collapsed); |
|
319 | 318 | this.output_area.toggle_output(); |
|
320 | 319 | }; |
|
321 | 320 | |
|
322 | 321 | |
|
323 | 322 | CodeCell.prototype.toggle_output_scroll = function () { |
|
324 | 323 | this.output_area.toggle_scroll(); |
|
325 | 324 | }; |
|
326 | 325 | |
|
327 | 326 | |
|
328 | 327 | CodeCell.input_prompt_classical = function (prompt_value, lines_number) { |
|
329 | 328 | var ns = prompt_value || " "; |
|
330 | 329 | return 'In [' + ns + ']:' |
|
331 | 330 | }; |
|
332 | 331 | |
|
333 | 332 | CodeCell.input_prompt_continuation = function (prompt_value, lines_number) { |
|
334 | 333 | var html = [CodeCell.input_prompt_classical(prompt_value, lines_number)]; |
|
335 | 334 | for(var i=1; i < lines_number; i++){html.push(['...:'])}; |
|
336 | 335 | return html.join('</br>') |
|
337 | 336 | }; |
|
338 | 337 | |
|
339 | 338 | CodeCell.input_prompt_function = CodeCell.input_prompt_classical; |
|
340 | 339 | |
|
341 | 340 | |
|
342 | 341 | CodeCell.prototype.set_input_prompt = function (number) { |
|
343 | 342 | var nline = 1 |
|
344 | 343 | if( this.code_mirror != undefined) { |
|
345 | 344 | nline = this.code_mirror.lineCount(); |
|
346 | 345 | } |
|
347 | 346 | this.input_prompt_number = number; |
|
348 | 347 | var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline); |
|
349 | 348 | this.element.find('div.input_prompt').html(prompt_html); |
|
350 | 349 | }; |
|
351 | 350 | |
|
352 | 351 | |
|
353 | 352 | CodeCell.prototype.clear_input = function () { |
|
354 | 353 | this.code_mirror.setValue(''); |
|
355 | 354 | }; |
|
356 | 355 | |
|
357 | 356 | |
|
358 | 357 | CodeCell.prototype.get_text = function () { |
|
359 | 358 | return this.code_mirror.getValue(); |
|
360 | 359 | }; |
|
361 | 360 | |
|
362 | 361 | |
|
363 | 362 | CodeCell.prototype.set_text = function (code) { |
|
364 | 363 | return this.code_mirror.setValue(code); |
|
365 | 364 | }; |
|
366 | 365 | |
|
367 | 366 | |
|
368 | 367 | CodeCell.prototype.at_top = function () { |
|
369 | 368 | var cursor = this.code_mirror.getCursor(); |
|
370 | 369 | if (cursor.line === 0 && cursor.ch === 0) { |
|
371 | 370 | return true; |
|
372 | 371 | } else { |
|
373 | 372 | return false; |
|
374 | 373 | } |
|
375 | 374 | }; |
|
376 | 375 | |
|
377 | 376 | |
|
378 | 377 | CodeCell.prototype.at_bottom = function () { |
|
379 | 378 | var cursor = this.code_mirror.getCursor(); |
|
380 | 379 | if (cursor.line === (this.code_mirror.lineCount()-1) && cursor.ch === this.code_mirror.getLine(cursor.line).length) { |
|
381 | 380 | return true; |
|
382 | 381 | } else { |
|
383 | 382 | return false; |
|
384 | 383 | } |
|
385 | 384 | }; |
|
386 | 385 | |
|
387 | 386 | |
|
388 | 387 | CodeCell.prototype.clear_output = function (stdout, stderr, other) { |
|
389 | 388 | this.output_area.clear_output(stdout, stderr, other); |
|
390 | 389 | }; |
|
391 | 390 | |
|
392 | 391 | |
|
393 | 392 | // JSON serialization |
|
394 | 393 | |
|
395 | 394 | CodeCell.prototype.fromJSON = function (data) { |
|
396 | 395 | IPython.Cell.prototype.fromJSON.apply(this, arguments); |
|
397 | 396 | if (data.cell_type === 'code') { |
|
398 | 397 | if (data.input !== undefined) { |
|
399 | 398 | this.set_text(data.input); |
|
400 | 399 | // make this value the starting point, so that we can only undo |
|
401 | 400 | // to this state, instead of a blank cell |
|
402 | 401 | this.code_mirror.clearHistory(); |
|
403 | 402 | this.auto_highlight(); |
|
404 | 403 | } |
|
405 | 404 | if (data.prompt_number !== undefined) { |
|
406 | 405 | this.set_input_prompt(data.prompt_number); |
|
407 | 406 | } else { |
|
408 | 407 | this.set_input_prompt(); |
|
409 | 408 | }; |
|
410 | 409 | this.output_area.fromJSON(data.outputs); |
|
411 | 410 | if (data.collapsed !== undefined) { |
|
412 | 411 | if (data.collapsed) { |
|
413 | 412 | this.collapse(); |
|
414 | 413 | } else { |
|
415 | 414 | this.expand(); |
|
416 | 415 | }; |
|
417 | 416 | }; |
|
418 | 417 | }; |
|
419 | 418 | }; |
|
420 | 419 | |
|
421 | 420 | |
|
422 | 421 | CodeCell.prototype.toJSON = function () { |
|
423 | 422 | var data = IPython.Cell.prototype.toJSON.apply(this); |
|
424 | 423 | data.input = this.get_text(); |
|
425 | 424 | data.cell_type = 'code'; |
|
426 | 425 | if (this.input_prompt_number) { |
|
427 | 426 | data.prompt_number = this.input_prompt_number; |
|
428 | 427 | }; |
|
429 | 428 | var outputs = this.output_area.toJSON(); |
|
430 | 429 | data.outputs = outputs; |
|
431 | 430 | data.language = 'python'; |
|
432 | 431 | data.collapsed = this.collapsed; |
|
433 | 432 | return data; |
|
434 | 433 | }; |
|
435 | 434 | |
|
436 | 435 | |
|
437 | 436 | IPython.CodeCell = CodeCell; |
|
438 | 437 | |
|
439 | 438 | return IPython; |
|
440 | 439 | }(IPython)); |
@@ -1,254 +1,257 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 | <script type="text/javascript"> | |
|
208 | CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js") }}"; | |
|
209 | </script> | |
|
207 | 210 | <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script> |
|
208 | 211 | <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script> |
|
209 | 212 | <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script> |
|
210 | 213 | <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script> |
|
211 | 214 | <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script> |
|
212 | 215 | <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script> |
|
213 | 216 | <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script> |
|
214 | 217 | <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script> |
|
215 | 218 | <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script> |
|
216 | 219 | <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script> |
|
217 | 220 | <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script> |
|
218 | 221 | <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script> |
|
219 | 222 | |
|
220 | 223 | <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script> |
|
221 | 224 | |
|
222 | 225 | <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script> |
|
223 | 226 | |
|
224 | 227 | <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script> |
|
225 | 228 | <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
226 | 229 | <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script> |
|
227 | 230 | <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
228 | 231 | <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
229 | 232 | <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
230 | 233 | <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
231 | 234 | <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
232 | 235 | <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
233 | 236 | <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script> |
|
234 | 237 | <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
235 | 238 | <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script> |
|
236 | 239 | <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
237 | 240 | <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script> |
|
238 | 241 | <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
239 | 242 | <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
240 | 243 | <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
241 | 244 | <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
242 | 245 | <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> |
|
243 | 246 | <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
244 | 247 | <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
245 | 248 | <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> |
|
246 | 249 | <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script> |
|
247 | 250 | <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script> |
|
248 | 251 | |
|
249 | 252 | <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script> |
|
250 | 253 | |
|
251 | 254 | <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script> |
|
252 | 255 | <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script> |
|
253 | 256 | |
|
254 | 257 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now