From 0e91477e000459bec0a91d925dc9b5049c5d1fb6 2014-07-03 10:05:49 From: Gordon Ball Date: 2014-07-03 10:05:49 Subject: [PATCH] Fix validate logic if min/max are changed --- diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py index 31ec6d1..cc55d9d 100644 --- a/IPython/html/widgets/widget_float.py +++ b/IPython/html/widgets/widget_float.py @@ -78,9 +78,11 @@ class _BoundedFloatRangeWidget(_FloatRangeWidget): """Validate min <= low <= high <= max""" if name == "value": low, high = new - low = max(low, self.min) - high = min(high, self.max) - self.value = (min(low, high), max(low, high)) + else: + low, high = self.value + low = max(low, self.min) + high = min(high, self.max) + self.value = (min(low, high), max(low, high)) class FloatRangeSliderWidget(_BoundedFloatRangeWidget): diff --git a/IPython/html/widgets/widget_int.py b/IPython/html/widgets/widget_int.py index 824e28a..ec8648f 100644 --- a/IPython/html/widgets/widget_int.py +++ b/IPython/html/widgets/widget_int.py @@ -77,9 +77,11 @@ class _BoundedIntRangeWidget(_IntRangeWidget): """Validate min <= low <= high <= max""" if name == "value": low, high = new - low = max(low, self.min) - high = min(high, self.max) - self.value = (min(low, high), max(low, high)) + else: + low, high = self.value + low = max(low, self.min) + high = min(high, self.max) + self.value = (min(low, high), max(low, high)) class IntRangeSliderWidget(_BoundedIntRangeWidget):