mirror of https://github.com/kivy/kivy.git
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:
parent
2ed7e22d3a
commit
a55874c2fd
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue