##// END OF EJS Templates
Remove 4-5 tuple forms from interact()
Gordon Ball -
Show More
@@ -23,7 +23,7 b' from inspect import getcallargs'
23 from IPython.core.getipython import get_ipython
23 from IPython.core.getipython import get_ipython
24 from IPython.html.widgets import (Widget, TextWidget,
24 from IPython.html.widgets import (Widget, TextWidget,
25 FloatSliderWidget, IntSliderWidget, CheckboxWidget, DropdownWidget,
25 FloatSliderWidget, IntSliderWidget, CheckboxWidget, DropdownWidget,
26 ContainerWidget, DOMWidget, IntRangeSliderWidget, FloatRangeSliderWidget)
26 ContainerWidget, DOMWidget)
27 from IPython.display import display, clear_output
27 from IPython.display import display, clear_output
28 from IPython.utils.py3compat import string_types, unicode_type
28 from IPython.utils.py3compat import string_types, unicode_type
29 from IPython.utils.traitlets import HasTraits, Any, Unicode
29 from IPython.utils.traitlets import HasTraits, Any, Unicode
@@ -107,26 +107,6 b' def _widget_abbrev(o):'
107 else:
107 else:
108 cls = FloatSliderWidget
108 cls = FloatSliderWidget
109 return cls(value=value, min=min, max=max, step=step)
109 return cls(value=value, min=min, max=max, step=step)
110 elif _matches(o, [float_or_int]*4):
111 min, low, high, max = o
112 if not min <= low <= high <= max:
113 raise ValueError("Range input expects min <= low <= high <= max, got {0}".format(o))
114 if all(isinstance(_, int) for _ in o):
115 cls = IntRangeSliderWidget
116 else:
117 cls = FloatRangeSliderWidget
118 return cls(value=(low, high), min=min, max=max)
119 elif _matches(o, [float_or_int]*5):
120 min, low, high, max, step = o
121 if not min <= low <= high <= max:
122 raise ValueError("Range input expects min <= low <= high <= max, got {0}".format(o))
123 if step <= 0:
124 raise ValueError("step must be >= 0, not %r" % step)
125 if all(isinstance(_, int) for _ in o):
126 cls = IntRangeSliderWidget
127 else:
128 cls = FloatRangeSliderWidget
129 return cls(value=(low, high), min=min, max=max, step=step)
130 else:
110 else:
131 return _widget_abbrev_single_value(o)
111 return _widget_abbrev_single_value(o)
132
112
General Comments 0
You need to be logged in to leave comments. Login now