From 44676698de1cdb52b6b58d0b756123ca616b6b0b 2015-01-20 21:16:26 From: Jonathan Frederic Date: 2015-01-20 21:16:26 Subject: [PATCH] Start forwarding the messages over widget custom messages --- diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index c09a049..f59515f 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -97,22 +97,6 @@ define([ this.input_prompt_number = null; this.celltoolbar = null; this.output_area = null; - // Keep a stack of the 'active' output areas (where active means the - // output area that recieves output). When a user activates an output - // area, it gets pushed to the stack. Then, when the output area is - // deactivated, it's popped from the stack. When the stack is empty, - // the cell's output area is used. - this.active_output_areas = []; - var that = this; - Object.defineProperty(this, 'active_output_area', { - get: function() { - if (that.active_output_areas && that.active_output_areas.length > 0) { - return that.active_output_areas[that.active_output_areas.length-1]; - } else { - return that.output_area; - } - }, - }); this.last_msg_id = null; this.completer = null; @@ -162,23 +146,6 @@ define([ CodeCell.prototype = Object.create(Cell.prototype); - /** - * @method push_output_area - */ - CodeCell.prototype.push_output_area = function (output_area) { - this.active_output_areas.push(output_area); - }; - - /** - * @method pop_output_area - */ - CodeCell.prototype.pop_output_area = function (output_area) { - var index = this.active_output_areas.lastIndexOf(output_area); - if (index > -1) { - this.active_output_areas.splice(index, 1); - } - }; - /** @method create_element */ CodeCell.prototype.create_element = function () { Cell.prototype.create_element.apply(this, arguments); @@ -409,7 +376,7 @@ define([ return; } - this.active_output_area.clear_output(false, true); + this.output_area.clear_output(false, true); if (stop_on_error === undefined) { stop_on_error = true; @@ -464,10 +431,10 @@ define([ }, iopub : { output : function() { - that.active_output_area.handle_output.apply(that.active_output_area, arguments); + that.output_area.handle_output.apply(that.output_area, arguments); }, clear_output : function() { - that.active_output_area.handle_clear_output.apply(that.active_output_area, arguments); + that.output_area.handle_clear_output.apply(that.output_area, arguments); }, }, input : $.proxy(this._handle_input_request, this) @@ -502,7 +469,7 @@ define([ * @private */ CodeCell.prototype._handle_input_request = function (msg) { - this.active_output_area.append_raw_input(msg); + this.output_area.append_raw_input(msg); }; @@ -605,7 +572,7 @@ define([ CodeCell.prototype.clear_output = function (wait) { - this.active_output_area.clear_output(wait); + this.output_area.clear_output(wait); this.set_input_prompt(); }; diff --git a/IPython/html/static/widgets/js/widget_output.js b/IPython/html/static/widgets/js/widget_output.js index c3c6320..6ad6e57 100644 --- a/IPython/html/static/widgets/js/widget_output.js +++ b/IPython/html/static/widgets/js/widget_output.js @@ -44,8 +44,26 @@ define([ }, _handle_route_msg: function(content) { - var cell = this.options.cell; - if (content && cell) { + if (content) { + // return { + // shell : { + // reply : $.proxy(this._handle_execute_reply, this), + // payload : { + // set_next_input : $.proxy(this._handle_set_next_input, this), + // page : $.proxy(this._open_with_pager, this) + // } + // }, + // iopub : { + // output : function() { + // that.output_area.handle_output.apply(that.output_area, arguments); + // }, + // clear_output : function() { + // that.output_area.handle_clear_output.apply(that.output_area, arguments); + // }, + // }, + // input : $.proxy(this._handle_input_request, this) + // }; + // }; if (content.method == 'push') { cell.push_output_area(this.output_area); } else if (content.method == 'pop') {