##// END OF EJS Templates
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook....
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook. Here's a brief overview of the changes: - Display of messages from other clients can be toggled on and off from within a notebook, either using the ``<M-m>e`` keyboard shortcut in the web UI, or through the option in the "Kernel" menu. - notebook.js controls whether messages are displayed through a callback that is invoked from kernel.js when no callbacks are available for a message. - The UI displays ``execute_input`` messages originating from an other clients in new cells at the end of the notebook. Output messages (``execute_result`` et al.) will only be displayed if a cell exists with a matching message ID. Pending design questions: - Should each ``execute_input`` message cause a new cell to be created? - Should new cells be placed at the end of the notebook, or elsewhere? If the latter, what criteria should be followed?

File last commit:

r18958:15da5bf1
r19164:17ac8ca3
Show More
widget_output.js
57 lines | 1.9 KiB | application/javascript | JavascriptLexer
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
define([
"widgets/js/widget",
"jquery",
'notebook/js/outputarea',
], function(widget, $, outputarea) {
'use strict';
var OutputView = widget.DOMWidgetView.extend({
initialize: function (parameters) {
// Public constructor
OutputView.__super__.initialize.apply(this, [parameters]);
this.model.on('msg:custom', this._handle_route_msg, this);
},
render: function(){
// Called when view is rendered.
this.output_area = new outputarea.OutputArea({
selector: this.$el,
prompt_area: false,
events: this.model.widget_manager.notebook.events,
keyboard_manager: this.model.widget_manager.keyboard_manager });
// Make output area reactive.
var that = this;
this.output_area.element.on('changed', function() {
that.model.set('contents', that.output_area.element.html());
});
this.model.on('change:contents', function(){
var html = this.model.get('contents');
if (this.output_area.element.html() != html) {
this.output_area.element.html(html);
}
}, this);
// Set initial contents.
this.output_area.element.html(this.model.get('contents'));
},
_handle_route_msg: function(content) {
var cell = this.options.cell;
if (content && cell) {
if (content.method == 'push') {
cell.push_output_area(this.output_area);
} else if (content.method == 'pop') {
cell.pop_output_area(this.output_area);
}
}
},
});
return {
'OutputView': OutputView,
};
});