From 20bae37c3d887be6000556be6520dceca4f69e11 Mon Sep 17 00:00:00 2001 From: Qua-non Date: Mon, 24 Sep 2012 18:53:21 +0530 Subject: [PATCH 1/2] UIX: Slider: fix value when min and step > 0 ( #694 ) --- kivy/uix/slider.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kivy/uix/slider.py b/kivy/uix/slider.py index 936ee0dbb..5bebcb674 100644 --- a/kivy/uix/slider.py +++ b/kivy/uix/slider.py @@ -112,7 +112,7 @@ class Slider(Widget): if step == 0: self.value = val else: - self.value = min(round((val - vmin) / step) * step, self.max) + self.value = min(round((val - vmin) / step) * step, self.max) + vmin value_normalized = AliasProperty(get_norm_value, set_norm_value, bind=('value', 'min', 'max', 'step')) '''Normalized value inside the :data:`range` (min/max) to 0-1 range:: @@ -174,6 +174,10 @@ class Slider(Widget): :data:`value_pos` is an :class:`~kivy.properties.AliasProperty`. ''' + def __init__(self, **kwargs): + super(Slider, self).__init__(**kwargs) + self.value_normalized = 0.1 + def on_touch_down(self, touch): if self.collide_point(*touch.pos): touch.grab(self) From 50c9ad36a5b6095b6f065f2670177796c14449bd Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 25 Sep 2012 16:47:12 +0200 Subject: [PATCH 2/2] remove invalid init. closes #694 --- kivy/uix/slider.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kivy/uix/slider.py b/kivy/uix/slider.py index 5bebcb674..e73c41d41 100644 --- a/kivy/uix/slider.py +++ b/kivy/uix/slider.py @@ -174,10 +174,6 @@ class Slider(Widget): :data:`value_pos` is an :class:`~kivy.properties.AliasProperty`. ''' - def __init__(self, **kwargs): - super(Slider, self).__init__(**kwargs) - self.value_normalized = 0.1 - def on_touch_down(self, touch): if self.collide_point(*touch.pos): touch.grab(self)