From a55874c2fd637b310ffd507a08ccfc35f68941c1 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 25 Sep 2012 18:21:32 +0200 Subject: [PATCH] settings: detect int/float numeric by the initial dot in the value. we cannot use another way, because the original config is in text. closes #669 --- kivy/uix/settings.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kivy/uix/settings.py b/kivy/uix/settings.py index f05e1d63c..ee7a0febb 100644 --- a/kivy/uix/settings.py +++ b/kivy/uix/settings.py @@ -455,9 +455,15 @@ class SettingNumeric(SettingString): ''' def _validate(self, instance): + # we know the type just by checking if there is a '.' in the original + # value + is_float = '.' in str(self.value) self._dismiss() try: - self.value = int(self.textinput.text) + if is_float: + self.value = float(self.textinput.text) + else: + self.value = int(self.textinput.text) except ValueError: return