diff --git a/IPython/html/static/widgets/js/widget_int.js b/IPython/html/static/widgets/js/widget_int.js
index a990fd0..725821d 100644
--- a/IPython/html/static/widgets/js/widget_int.js
+++ b/IPython/html/static/widgets/js/widget_int.js
@@ -320,6 +320,11 @@ define([
.css('width', '50%')
.appendTo(this.$progress);
this.update(); // Set defaults.
+
+ this.model.on('change:bar_style', function(model, value) {
+ this.update_bar_style();
+ }, this);
+ this.update_bar_style('');
},
update : function(){
@@ -344,6 +349,16 @@ define([
return ProgressView.__super__.update.apply(this);
},
+ update_bar_style: function(previous_trait_value) {
+ var class_map = {
+ success: ['progress-bar-success'],
+ info: ['progress-bar-info'],
+ warning: ['progress-bar-warning'],
+ danger: ['progress-bar-danger']
+ };
+ this.update_mapped_classes(class_map, 'bar_style', previous_trait_value, this.$bar);
+ },
+
update_attr: function(name, value) {
// Set a css attr of the widget view.
if (name.substring(0, 6) == 'border' || name == 'width' ||
diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py
index 9705266..57a78d0 100644
--- a/IPython/html/widgets/widget_bool.py
+++ b/IPython/html/widgets/widget_bool.py
@@ -14,7 +14,7 @@ Represents a boolean using a widget.
# Imports
#-----------------------------------------------------------------------------
from .widget import DOMWidget
-from IPython.utils.traitlets import Unicode, Bool
+from IPython.utils.traitlets import Unicode, Bool, CaselessStrEnum
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
diff --git a/IPython/html/widgets/widget_button.py b/IPython/html/widgets/widget_button.py
index fc9b116..7ba0ad1 100644
--- a/IPython/html/widgets/widget_button.py
+++ b/IPython/html/widgets/widget_button.py
@@ -15,7 +15,7 @@ click events on the button and trigger backend code when the clicks are fired.
# Imports
#-----------------------------------------------------------------------------
from .widget import DOMWidget, CallbackDispatcher
-from IPython.utils.traitlets import Unicode, Bool
+from IPython.utils.traitlets import Unicode, Bool, CaselessStrEnum
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py
index 10db14c..64f2d3b 100644
--- a/IPython/html/widgets/widget_float.py
+++ b/IPython/html/widgets/widget_float.py
@@ -14,7 +14,7 @@ Represents an unbounded float using a widget.
# Imports
#-----------------------------------------------------------------------------
from .widget import DOMWidget
-from IPython.utils.traitlets import Unicode, CFloat, Bool, Enum, Tuple
+from IPython.utils.traitlets import Unicode, CFloat, Bool, CaselessStrEnum, Tuple
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
@@ -53,8 +53,9 @@ class BoundedFloatText(_BoundedFloat):
class FloatSlider(_BoundedFloat):
_view_name = Unicode('FloatSliderView', sync=True)
- orientation = Enum([u'horizontal', u'vertical'], u'horizontal',
- help="Vertical or horizontal.", sync=True)
+ orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
+ default_value='horizontal',
+ help="Vertical or horizontal.", allow_none=False, sync=True)
_range = Bool(False, help="Display a range selector", sync=True)
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)
slider_color = Unicode(sync=True)
@@ -63,6 +64,11 @@ class FloatSlider(_BoundedFloat):
class FloatProgress(_BoundedFloat):
_view_name = Unicode('ProgressView', sync=True)
+ bar_style = CaselessStrEnum(
+ values=['success', 'info', 'warning', 'danger', ''],
+ default_value='', allow_none=True, sync=True, help="""Use a
+ predefined styling for the progess bar.""")
+
class _FloatRange(_Float):
value = Tuple(CFloat, CFloat, default_value=(0.0, 1.0), help="Tuple of (lower, upper) bounds", sync=True)
lower = CFloat(0.0, help="Lower bound", sync=False)
diff --git a/IPython/html/widgets/widget_int.py b/IPython/html/widgets/widget_int.py
index 81ba8b5..a98692c 100644
--- a/IPython/html/widgets/widget_int.py
+++ b/IPython/html/widgets/widget_int.py
@@ -14,7 +14,7 @@ Represents an unbounded int using a widget.
# Imports
#-----------------------------------------------------------------------------
from .widget import DOMWidget
-from IPython.utils.traitlets import Unicode, CInt, Bool, Enum, Tuple
+from IPython.utils.traitlets import Unicode, CInt, Bool, CaselessStrEnum, Tuple
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
@@ -58,7 +58,8 @@ class BoundedIntText(_BoundedInt):
class IntSlider(_BoundedInt):
"""Slider widget that represents a int bounded by a minimum and maximum value."""
_view_name = Unicode('IntSliderView', sync=True)
- orientation = Enum([u'horizontal', u'vertical'], u'horizontal',
+ orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
+ default_value='horizontal', allow_none=False,
help="Vertical or horizontal.", sync=True)
_range = Bool(False, help="Display a range selector", sync=True)
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)
@@ -69,6 +70,11 @@ class IntProgress(_BoundedInt):
"""Progress bar that represents a int bounded by a minimum and maximum value."""
_view_name = Unicode('ProgressView', sync=True)
+ bar_style = CaselessStrEnum(
+ values=['success', 'info', 'warning', 'danger', ''],
+ default_value='', allow_none=True, sync=True, help="""Use a
+ predefined styling for the progess bar.""")
+
class _IntRange(_Int):
value = Tuple(CInt, CInt, default_value=(0, 1), help="Tuple of (lower, upper) bounds", sync=True)
lower = CInt(0, help="Lower bound", sync=False)
diff --git a/IPython/html/widgets/widget_selection.py b/IPython/html/widgets/widget_selection.py
index 9f7a9d8..d463049 100644
--- a/IPython/html/widgets/widget_selection.py
+++ b/IPython/html/widgets/widget_selection.py
@@ -18,7 +18,7 @@ from collections import OrderedDict
from threading import Lock
from .widget import DOMWidget
-from IPython.utils.traitlets import Unicode, List, Bool, Any, Dict, TraitError
+from IPython.utils.traitlets import Unicode, List, Bool, Any, Dict, TraitError, CaselessStrEnum
from IPython.utils.py3compat import unicode_type
from IPython.utils.warn import DeprecatedClass
@@ -125,6 +125,11 @@ class Dropdown(_Selection):
"""Allows you to select a single item from a dropdown."""
_view_name = Unicode('DropdownView', sync=True)
+ button_style = CaselessStrEnum(
+ values=['primary', 'success', 'info', 'warning', 'danger', ''],
+ default_value='', allow_none=True, sync=True, help="""Use a
+ predefined styling for the buttons.""")
+
class RadioButtons(_Selection):
"""Group of radio buttons that represent an enumeration. Only one radio