Show More
@@ -293,9 +293,6 define([ | |||
|
293 | 293 | }); |
|
294 | 294 | |
|
295 | 295 | // Kernel |
|
296 | this.element.find('#toggle_unsolicited').click(function() { | |
|
297 | IPython.notebook.toggle_ignore_unsolicited_msgs(); | |
|
298 | }); | |
|
299 | 296 | this.element.find('#int_kernel').click(function () { |
|
300 | 297 | that.notebook.kernel.interrupt(); |
|
301 | 298 | }); |
@@ -137,7 +137,6 define([ | |||
|
137 | 137 | this.undelete_below = false; |
|
138 | 138 | this.paste_enabled = false; |
|
139 | 139 | this.writable = false; |
|
140 | this.include_other_output = true; | |
|
141 | 140 | // It is important to start out in command mode to match the intial mode |
|
142 | 141 | // of the KeyboardManager. |
|
143 | 142 | this.mode = 'command'; |
@@ -1574,60 +1573,6 define([ | |||
|
1574 | 1573 | this.get_selected_cell().toggle_line_numbers(); |
|
1575 | 1574 | }; |
|
1576 | 1575 | |
|
1577 | // Support for displaying input and output messages from other iPy clients. | |
|
1578 | ||
|
1579 | /** | |
|
1580 | * Toggles the ability to display input/output message events from | |
|
1581 | * externally connected clients (i.e. other iPython shells, vim-ipython, | |
|
1582 | * etc). | |
|
1583 | * | |
|
1584 | * @method toggle_ignore_unsolicited_msgs | |
|
1585 | */ | |
|
1586 | Notebook.prototype.toggle_ignore_unsolicited_msgs = function () { | |
|
1587 | this.include_other_output = !this.include_other_output; | |
|
1588 | this.events.trigger('toggle_other_client_output.Notebook', | |
|
1589 | [this.include_other_output]); | |
|
1590 | return this.include_other_output; | |
|
1591 | }; | |
|
1592 | ||
|
1593 | /** | |
|
1594 | * Handles the display of unsolicited messages, i.e. inputs or outputs that | |
|
1595 | * were generated by a client other than this notebook. New messages are | |
|
1596 | * displayed at the bottom of the notebook. | |
|
1597 | * | |
|
1598 | * @method handle_unsolicited_msg | |
|
1599 | */ | |
|
1600 | Notebook.prototype.handle_unsolicited_msg = function(msg) { | |
|
1601 | if (!this.include_other_output) { | |
|
1602 | return; | |
|
1603 | } | |
|
1604 | if (msg.msg_type == 'execute_input') { | |
|
1605 | var cell = this.insert_cell_at_bottom('code'); | |
|
1606 | if (cell) { | |
|
1607 | var cell_index = this.ncells() - 1; | |
|
1608 | cell.last_msg_id = msg.parent_header.msg_id; | |
|
1609 | cell.set_text(msg.content.code); | |
|
1610 | cell._handle_execute_reply(msg); | |
|
1611 | this.scroll_to_cell(cell_index); | |
|
1612 | this.select(cell_index); | |
|
1613 | } | |
|
1614 | } else { | |
|
1615 | /* Find the input cell that corresponds with the output, then add | |
|
1616 | * the contents to the cell's output area. | |
|
1617 | */ | |
|
1618 | var count = this.ncells(); | |
|
1619 | while (count--) { | |
|
1620 | var cell = this.get_cell(count); | |
|
1621 | if (cell && cell.last_msg_id == msg.parent_header.msg_id) { | |
|
1622 | cell.output_area.handle_output(msg); | |
|
1623 | this.scroll_to_cell(count); | |
|
1624 | this.select(count); | |
|
1625 | break; | |
|
1626 | } | |
|
1627 | } | |
|
1628 | } | |
|
1629 | }; | |
|
1630 | ||
|
1631 | 1576 | /** |
|
1632 | 1577 | * Set the codemirror mode for all code cells, including the default for |
|
1633 | 1578 | * new code cells. |
@@ -1705,7 +1650,6 define([ | |||
|
1705 | 1650 | cell.set_kernel(this.session.kernel); |
|
1706 | 1651 | } |
|
1707 | 1652 | } |
|
1708 | this.kernel.unsolicited_msg_callback = $.proxy(this.handle_unsolicited_msg, this); | |
|
1709 | 1653 | }; |
|
1710 | 1654 | Notebook.prototype._session_start_failed = function (jqxhr, status, error){ |
|
1711 | 1655 | this._session_starting = false; |
@@ -279,11 +279,6 define([ | |||
|
279 | 279 | nnw.warning(error.message || "Notebook copy failed"); |
|
280 | 280 | }); |
|
281 | 281 | |
|
282 | this.events.on('toggle_other_client_output.Notebook', function(evt, include_output) { | |
|
283 | var msg = (include_output? "Showing": "Ignoring") + " output from other clients"; | |
|
284 | nnw.set_message(msg, 2000); | |
|
285 | }); | |
|
286 | ||
|
287 | 282 | // Checkpoint events |
|
288 | 283 | this.events.on('checkpoint_created.Notebook', function (evt, data) { |
|
289 | 284 | var msg = "Checkpoint created"; |
@@ -47,7 +47,6 define([ | |||
|
47 | 47 | this.session_id = utils.uuid(); |
|
48 | 48 | this._msg_callbacks = {}; |
|
49 | 49 | this.info_reply = {}; // kernel_info_reply stored here after starting |
|
50 | this.unsolicited_msg_callback = null; | |
|
51 | 50 | |
|
52 | 51 | if (typeof(WebSocket) !== 'undefined') { |
|
53 | 52 | this.WebSocket = WebSocket; |
@@ -1000,11 +999,9 define([ | |||
|
1000 | 999 | Kernel.prototype._handle_output_message = function (msg) { |
|
1001 | 1000 | var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id); |
|
1002 | 1001 | if (!callbacks || !callbacks.iopub) { |
|
1003 | if (this.unsolicited_msg_callback) { | |
|
1004 | // The message came from another client. Let the UI decide what | |
|
1005 | // to do with it. | |
|
1006 | this.unsolicited_msg_callback(msg); | |
|
1007 | } | |
|
1002 | // The message came from another client. Let the UI decide what to | |
|
1003 | // do with it. | |
|
1004 | this.events.trigger('received_unsolicited_message.Kernel', msg); | |
|
1008 | 1005 | return; |
|
1009 | 1006 | } |
|
1010 | 1007 | var callback = callbacks.iopub.output; |
@@ -1020,10 +1017,10 define([ | |||
|
1020 | 1017 | */ |
|
1021 | 1018 | Kernel.prototype._handle_input_message = function (msg) { |
|
1022 | 1019 | var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id); |
|
1023 |
if (!callbacks |
|
|
1020 | if (!callbacks) { | |
|
1024 | 1021 | // The message came from another client. Let the UI decide what to |
|
1025 | 1022 | // do with it. |
|
1026 |
this. |
|
|
1023 | this.events.trigger('received_unsolicited_message.Kernel', msg); | |
|
1027 | 1024 | } |
|
1028 | 1025 | }; |
|
1029 | 1026 |
@@ -226,9 +226,6 class="notebook_app" | |||
|
226 | 226 | </li> |
|
227 | 227 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> |
|
228 | 228 | <ul id="kernel_menu" class="dropdown-menu"> |
|
229 | <li id="toggle_unsolicited" | |
|
230 | title="Toggles display of messages from clients other than this one sharing the same kernel."> | |
|
231 | <a href="#">Show/ignore output from other clients.</a></li> | |
|
232 | 229 | <li id="int_kernel" |
|
233 | 230 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> |
|
234 | 231 | <a href="#">Interrupt</a> |
General Comments 0
You need to be logged in to leave comments.
Login now