diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js index 2b3c2f6d0..3c5664799 100644 --- a/IPython/html/static/notebook/js/widgets/widget.js +++ b/IPython/html/static/notebook/js/widgets/widget.js @@ -269,8 +269,13 @@ function(widget_manager, underscore, backbone){ }, update: function () { - // the very first update seems to happen before the element is finished rendering - // so we use setTimeout to give the element time to render + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. + // The very first update seems to happen before the element is + // finished rendering so we use setTimeout to give the element time + // to render var e = this.$el; var visible = this.model.get('visible'); setTimeout(function() {e.toggle(visible)},0); diff --git a/IPython/html/static/notebook/js/widgets/widget_bool.js b/IPython/html/static/notebook/js/widgets/widget_bool.js index be090ac09..334ebd500 100644 --- a/IPython/html/static/notebook/js/widgets/widget_bool.js +++ b/IPython/html/static/notebook/js/widgets/widget_bool.js @@ -44,9 +44,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. if (!this.user_invoked_update) { this.$checkbox.prop('checked', this.model.get('value')); @@ -84,9 +86,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. if (!this.user_invoked_update) { if (this.model.get('value')) { this.$button.addClass('active'); diff --git a/IPython/html/static/notebook/js/widgets/widget_button.js b/IPython/html/static/notebook/js/widgets/widget_button.js index 60d535f85..9d751554f 100644 --- a/IPython/html/static/notebook/js/widgets/widget_button.js +++ b/IPython/html/static/notebook/js/widgets/widget_button.js @@ -30,9 +30,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. var description = this.model.get('description'); description = description.replace(/ /g, ' ', 'm'); description = description.replace(/\n/g, '
\n', 'm'); diff --git a/IPython/html/static/notebook/js/widgets/widget_container.js b/IPython/html/static/notebook/js/widgets/widget_container.js index c04b29675..9f49da6fc 100644 --- a/IPython/html/static/notebook/js/widgets/widget_container.js +++ b/IPython/html/static/notebook/js/widgets/widget_container.js @@ -69,6 +69,10 @@ define(["notebook/js/widgets/widget"], function(widget_manager) { }, update: function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. set_flex_properties(this, this.$el); return IPython.DOMWidgetView.prototype.update.call(this); }, @@ -225,6 +229,10 @@ define(["notebook/js/widgets/widget"], function(widget_manager) { }, update: function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. set_flex_properties(this, this.$body); var description = this.model.get('description'); diff --git a/IPython/html/static/notebook/js/widgets/widget_image.js b/IPython/html/static/notebook/js/widgets/widget_image.js index e72010af4..03456d8f2 100644 --- a/IPython/html/static/notebook/js/widgets/widget_image.js +++ b/IPython/html/static/notebook/js/widgets/widget_image.js @@ -26,9 +26,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. var image_src = 'data:image/' + this.model.get('image_format') + ';base64,' + this.model.get('_b64value'); this.$el.attr('src', image_src); diff --git a/IPython/html/static/notebook/js/widgets/widget_multicontainer.js b/IPython/html/static/notebook/js/widgets/widget_multicontainer.js index d4781e7fa..8dc835454 100644 --- a/IPython/html/static/notebook/js/widgets/widget_multicontainer.js +++ b/IPython/html/static/notebook/js/widgets/widget_multicontainer.js @@ -45,6 +45,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ update: function() { + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. + // Set tab titles var titles = this.model.get('_titles'); for (var page_index in titles) { @@ -153,6 +158,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ }, update: function() { + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. + // Set tab titles var titles = this.model.get('_titles'); for (var page_index in titles) { diff --git a/IPython/html/static/notebook/js/widgets/widget_selection.js b/IPython/html/static/notebook/js/widgets/widget_selection.js index 02ad8ef7c..80893afb3 100644 --- a/IPython/html/static/notebook/js/widgets/widget_selection.js +++ b/IPython/html/static/notebook/js/widgets/widget_selection.js @@ -55,9 +55,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. var selected_item_text = this.model.get('value'); selected_item_text = selected_item_text.replace(/ /g, ' '); @@ -129,9 +131,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. // Add missing items to the DOM. var items = this.model.get('values'); @@ -216,9 +220,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. // Add missing items to the DOM. var items = this.model.get('values'); @@ -298,9 +304,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. // Add missing items to the DOM. var items = this.model.get('values'); diff --git a/IPython/html/static/notebook/js/widgets/widget_string.js b/IPython/html/static/notebook/js/widgets/widget_string.js index d8e51067b..9384fa241 100644 --- a/IPython/html/static/notebook/js/widgets/widget_string.js +++ b/IPython/html/static/notebook/js/widgets/widget_string.js @@ -25,9 +25,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. this.$el.html(this.model.get('value')); return IPython.DOMWidgetView.prototype.update.call(this); }, @@ -44,9 +46,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update : function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. this.$el.html(this.model.get('value')); MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$el.get(0)]); @@ -91,9 +95,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update: function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. if (!this.user_invoked_update) { this.$textbox.val(this.model.get('value')); } @@ -145,9 +151,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){ this.update(); // Set defaults. }, - // Handles: Backend -> Frontend Sync - // Frontent -> Frontend Sync update: function(){ + // Update the contents of this view + // + // Called when the model is changed. The model may have been + // changed by another view or by a state update from the back-end. if (this.$textbox.val() != this.model.get('value')) { this.$textbox.val(this.model.get('value')); }