Show More
@@ -161,7 +161,7 b' var IPython = (function (IPython) {' | |||||
161 | 'execute_reply': $.proxy(this._handle_execute_reply, this), |
|
161 | 'execute_reply': $.proxy(this._handle_execute_reply, this), | |
162 | 'output': $.proxy(this.output_area.handle_output, this.output_area), |
|
162 | 'output': $.proxy(this.output_area.handle_output, this.output_area), | |
163 | 'clear_output': $.proxy(this.output_area.handle_clear_output, this.output_area), |
|
163 | 'clear_output': $.proxy(this.output_area.handle_clear_output, this.output_area), | |
164 | 'cell': this |
|
164 | 'set_next_input': $.proxy(this._handle_set_next_input, this) | |
165 | }; |
|
165 | }; | |
166 | var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false}); |
|
166 | var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false}); | |
167 | }; |
|
167 | }; | |
@@ -173,6 +173,11 b' var IPython = (function (IPython) {' | |||||
173 | // this.dirty = true; |
|
173 | // this.dirty = true; | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
|
176 | CodeCell.prototype._handle_set_next_input = function (text) { | |||
|
177 | var data = {'cell': this, 'text': text} | |||
|
178 | $([IPython.events]).trigger('set_next_input.Notebook', data); | |||
|
179 | } | |||
|
180 | ||||
176 | // Basic cell manipulation. |
|
181 | // Basic cell manipulation. | |
177 |
|
182 | |||
178 | CodeCell.prototype.select = function () { |
|
183 | CodeCell.prototype.select = function () { |
@@ -216,7 +216,7 b' var IPython = (function (IPython) {' | |||||
216 | // 'execute_reply': execute_reply_callback, |
|
216 | // 'execute_reply': execute_reply_callback, | |
217 | // 'output': output_callback, |
|
217 | // 'output': output_callback, | |
218 | // 'clear_output': clear_output_callback, |
|
218 | // 'clear_output': clear_output_callback, | |
219 | // 'cell': cell |
|
219 | // 'set_next_input': set_next_input_callback | |
220 | // } |
|
220 | // } | |
221 | // |
|
221 | // | |
222 | // The execute_reply_callback will be passed the content object of the execute_reply |
|
222 | // The execute_reply_callback will be passed the content object of the execute_reply | |
@@ -233,8 +233,8 b' var IPython = (function (IPython) {' | |||||
233 | // The clear_output_callback will be passed a content object that contains |
|
233 | // The clear_output_callback will be passed a content object that contains | |
234 | // stdout, stderr and other fields that are booleans. |
|
234 | // stdout, stderr and other fields that are booleans. | |
235 | // |
|
235 | // | |
236 | // The cell value will contain the a cell object that the notebook can use for the |
|
236 | // The set_next_input_callback will bepassed the text that should become the next | |
237 |
// |
|
237 | // input cell. | |
238 |
|
238 | |||
239 | var content = { |
|
239 | var content = { | |
240 | code : code, |
|
240 | code : code, | |
@@ -321,14 +321,14 b' var IPython = (function (IPython) {' | |||||
321 | } |
|
321 | } | |
322 | }; |
|
322 | }; | |
323 |
|
323 | |||
324 |
if (content.payload !== undefined |
|
324 | if (content.payload !== undefined) { | |
325 | var payload = content.payload || []; |
|
325 | var payload = content.payload || []; | |
326 |
this._handle_payload(callbacks |
|
326 | this._handle_payload(callbacks, payload); | |
327 | } |
|
327 | } | |
328 | }; |
|
328 | }; | |
329 |
|
329 | |||
330 |
|
330 | |||
331 |
Kernel.prototype._handle_payload = function (c |
|
331 | Kernel.prototype._handle_payload = function (callbacks, payload) { | |
332 | var l = payload.length; |
|
332 | var l = payload.length; | |
333 | // Payloads are handled by triggering events because we don't want the Kernel |
|
333 | // Payloads are handled by triggering events because we don't want the Kernel | |
334 | // to depend on the Notebook or Pager classes. |
|
334 | // to depend on the Notebook or Pager classes. | |
@@ -336,9 +336,10 b' var IPython = (function (IPython) {' | |||||
336 | if (payload[i].source === 'IPython.zmq.page.page') { |
|
336 | if (payload[i].source === 'IPython.zmq.page.page') { | |
337 | var data = {'text':payload[i].text} |
|
337 | var data = {'text':payload[i].text} | |
338 | $([IPython.events]).trigger('open_with_text.Pager', data); |
|
338 | $([IPython.events]).trigger('open_with_text.Pager', data); | |
339 |
} else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input' |
|
339 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { | |
340 | var data = {'cell': cell, 'text': payload[i].text} |
|
340 | if (callbacks.set_next_input !== undefined) { | |
341 | $([IPython.events]).trigger('set_next_input.Notebook', data); |
|
341 | callbacks.set_next_input(payload[i].text) | |
|
342 | } | |||
342 | } |
|
343 | } | |
343 | }; |
|
344 | }; | |
344 | }; |
|
345 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now