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