##// END OF EJS Templates
Start forwarding the messages over widget custom messages
Jonathan Frederic -
Show More
@@ -97,22 +97,6 b' define(['
97 this.input_prompt_number = null;
97 this.input_prompt_number = null;
98 this.celltoolbar = null;
98 this.celltoolbar = null;
99 this.output_area = null;
99 this.output_area = null;
100 // Keep a stack of the 'active' output areas (where active means the
101 // output area that recieves output). When a user activates an output
102 // area, it gets pushed to the stack. Then, when the output area is
103 // deactivated, it's popped from the stack. When the stack is empty,
104 // the cell's output area is used.
105 this.active_output_areas = [];
106 var that = this;
107 Object.defineProperty(this, 'active_output_area', {
108 get: function() {
109 if (that.active_output_areas && that.active_output_areas.length > 0) {
110 return that.active_output_areas[that.active_output_areas.length-1];
111 } else {
112 return that.output_area;
113 }
114 },
115 });
116
100
117 this.last_msg_id = null;
101 this.last_msg_id = null;
118 this.completer = null;
102 this.completer = null;
@@ -162,23 +146,6 b' define(['
162
146
163 CodeCell.prototype = Object.create(Cell.prototype);
147 CodeCell.prototype = Object.create(Cell.prototype);
164
148
165 /**
166 * @method push_output_area
167 */
168 CodeCell.prototype.push_output_area = function (output_area) {
169 this.active_output_areas.push(output_area);
170 };
171
172 /**
173 * @method pop_output_area
174 */
175 CodeCell.prototype.pop_output_area = function (output_area) {
176 var index = this.active_output_areas.lastIndexOf(output_area);
177 if (index > -1) {
178 this.active_output_areas.splice(index, 1);
179 }
180 };
181
182 /** @method create_element */
149 /** @method create_element */
183 CodeCell.prototype.create_element = function () {
150 CodeCell.prototype.create_element = function () {
184 Cell.prototype.create_element.apply(this, arguments);
151 Cell.prototype.create_element.apply(this, arguments);
@@ -409,7 +376,7 b' define(['
409 return;
376 return;
410 }
377 }
411
378
412 this.active_output_area.clear_output(false, true);
379 this.output_area.clear_output(false, true);
413
380
414 if (stop_on_error === undefined) {
381 if (stop_on_error === undefined) {
415 stop_on_error = true;
382 stop_on_error = true;
@@ -464,10 +431,10 b' define(['
464 },
431 },
465 iopub : {
432 iopub : {
466 output : function() {
433 output : function() {
467 that.active_output_area.handle_output.apply(that.active_output_area, arguments);
434 that.output_area.handle_output.apply(that.output_area, arguments);
468 },
435 },
469 clear_output : function() {
436 clear_output : function() {
470 that.active_output_area.handle_clear_output.apply(that.active_output_area, arguments);
437 that.output_area.handle_clear_output.apply(that.output_area, arguments);
471 },
438 },
472 },
439 },
473 input : $.proxy(this._handle_input_request, this)
440 input : $.proxy(this._handle_input_request, this)
@@ -502,7 +469,7 b' define(['
502 * @private
469 * @private
503 */
470 */
504 CodeCell.prototype._handle_input_request = function (msg) {
471 CodeCell.prototype._handle_input_request = function (msg) {
505 this.active_output_area.append_raw_input(msg);
472 this.output_area.append_raw_input(msg);
506 };
473 };
507
474
508
475
@@ -605,7 +572,7 b' define(['
605
572
606
573
607 CodeCell.prototype.clear_output = function (wait) {
574 CodeCell.prototype.clear_output = function (wait) {
608 this.active_output_area.clear_output(wait);
575 this.output_area.clear_output(wait);
609 this.set_input_prompt();
576 this.set_input_prompt();
610 };
577 };
611
578
@@ -44,8 +44,26 b' define(['
44 },
44 },
45
45
46 _handle_route_msg: function(content) {
46 _handle_route_msg: function(content) {
47 var cell = this.options.cell;
47 if (content) {
48 if (content && cell) {
48 // return {
49 // shell : {
50 // reply : $.proxy(this._handle_execute_reply, this),
51 // payload : {
52 // set_next_input : $.proxy(this._handle_set_next_input, this),
53 // page : $.proxy(this._open_with_pager, this)
54 // }
55 // },
56 // iopub : {
57 // output : function() {
58 // that.output_area.handle_output.apply(that.output_area, arguments);
59 // },
60 // clear_output : function() {
61 // that.output_area.handle_clear_output.apply(that.output_area, arguments);
62 // },
63 // },
64 // input : $.proxy(this._handle_input_request, this)
65 // };
66 // };
49 if (content.method == 'push') {
67 if (content.method == 'push') {
50 cell.push_output_area(this.output_area);
68 cell.push_output_area(this.output_area);
51 } else if (content.method == 'pop') {
69 } else if (content.method == 'pop') {
General Comments 0
You need to be logged in to leave comments. Login now