From 0e56b40a2238de0e17c5b9bfeb2791af66d87027 2014-01-16 12:08:22 From: Jonathan Frederic Date: 2014-01-16 12:08:22 Subject: [PATCH] Change orientation to Enum --- diff --git a/IPython/html/widgets/widget_float_range.py b/IPython/html/widgets/widget_float_range.py index 2552628..6d5aeb4 100644 --- a/IPython/html/widgets/widget_float_range.py +++ b/IPython/html/widgets/widget_float_range.py @@ -14,7 +14,7 @@ Represents a bounded float using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, CFloat, Bool, List +from IPython.utils.traitlets import Unicode, CFloat, Bool, List, Enum #----------------------------------------------------------------------------- # Classes @@ -41,7 +41,8 @@ class BoundedFloatTextWidget(DOMWidget): class FloatSliderWidget(BoundedFloatTextWidget): view_name = Unicode('FloatSliderView', sync=True) - orientation = Unicode(u'horizontal', help="Vertical or horizontal.", sync=True) + orientation = Enum([u'horizontal', u'vertical'], u'horizontal', + help="Vertical or horizontal.", sync=True) class FloatProgressWidget(BoundedFloatTextWidget): diff --git a/IPython/html/widgets/widget_int_range.py b/IPython/html/widgets/widget_int_range.py index 4605b98..7f3afa1 100644 --- a/IPython/html/widgets/widget_int_range.py +++ b/IPython/html/widgets/widget_int_range.py @@ -14,7 +14,7 @@ Represents a bounded int using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, CInt, Bool, List +from IPython.utils.traitlets import Unicode, CInt, Bool, List, Enum #----------------------------------------------------------------------------- # Classes @@ -43,7 +43,8 @@ class BoundedIntTextWidget(DOMWidget): class IntSliderWidget(BoundedIntTextWidget): view_name = Unicode('IntSliderView', sync=True) - orientation = Unicode(u'horizontal', help="Vertical or horizontal.", sync=True) + orientation = Enum([u'horizontal', u'vertical'], u'horizontal', + help="Vertical or horizontal.", sync=True) class IntProgressWidget(BoundedIntTextWidget):