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