From 633f8ad2296b8725e5ada890232409a646de5639 2014-08-28 18:09:55 From: Jonathan Frederic Date: 2014-08-28 18:09:55 Subject: [PATCH] Partial implementation of styles --- diff --git a/IPython/html/static/widgets/js/widget_bool.js b/IPython/html/static/widgets/js/widget_bool.js index 83af9d4..1b925af 100644 --- a/IPython/html/static/widgets/js/widget_bool.js +++ b/IPython/html/static/widgets/js/widget_bool.js @@ -24,6 +24,11 @@ define([ this.update(); // Set defaults. }, + update_attr: function(name, value) { + // Set a css attr of the widget view. + this.$checkbox.css(name, value); + }, + handle_click: function() { // Handles when the checkbox is clicked. diff --git a/IPython/html/static/widgets/js/widget_int.js b/IPython/html/static/widgets/js/widget_int.js index c8a736b..503fa0f 100644 --- a/IPython/html/static/widgets/js/widget_int.js +++ b/IPython/html/static/widgets/js/widget_int.js @@ -30,10 +30,30 @@ define([ .appendTo(this.$el) .addClass('widget-hreadout') .hide(); + + this.model.on('change:slider_color', function(sender, value) { + this.$slider.find('a').css('background', value); + }, this); // Set defaults. this.update(); }, + + update_attr: function(name, value) { + // Set a css attr of the widget view. + if (name == 'color') { + this.$readout.css(name, value); + } else if (name.substring(0, 4) == 'font') { + this.$readout.css(name, value); + } else if (name.substring(0, 6) == 'border') { + this.$slider.find('a').css(name, value); + this.$slider_container.css(name, value); + } else if (name == 'width' || name == 'height' || name == 'background') { + this.$slider_container.css(name, value); + } else { + this.$slider.css(name, value); + } + }, update : function(options){ // Update the contents of this view @@ -221,6 +241,11 @@ define([ return IntTextView.__super__.update.apply(this); }, + update_attr: function(name, value) { + // Set a css attr of the widget view. + this.$textbox.css(name, value); + }, + events: { // Dictionary of events and their handlers. "keyup input" : "handleChanging", @@ -320,6 +345,17 @@ define([ } return ProgressView.__super__.update.apply(this); }, + + update_attr: function(name, value) { + // Set a css attr of the widget view. + if (name.substring(0, 6) == 'border' || name == 'width' || name == 'height' || name == 'background') { + this.$progress.css(name, value); + } else if (name == 'color') { + this.$bar.css('background', value); + } else { + this.$bar.css(name, value); + } + }, }); return { diff --git a/IPython/html/static/widgets/js/widget_selection.js b/IPython/html/static/widgets/js/widget_selection.js index 3922dc9..99c01ee 100644 --- a/IPython/html/static/widgets/js/widget_selection.js +++ b/IPython/html/static/widgets/js/widget_selection.js @@ -58,6 +58,8 @@ define([ var items = this.model.get('value_names'); var $replace_droplist = $('