Start forwarding the messages over widget custom messages

pull/37/head
Jonathan Frederic 11 years ago
parent 7b8a64241f
commit 705bd90653

@ -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();
};

@ -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') {

Loading…
Cancel
Save