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

This commit is contained in:
Mathieu Virbel 2012-09-25 18:21:32 +02:00
parent 2ed7e22d3a
commit a55874c2fd
1 changed files with 7 additions and 1 deletions

View File

@ -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