wylark
/
munter.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d9e9fa4
)
Clean up user input on distance/elevation values
author
Alexander Vasarab <alexander@wylark.com>
Mon, 29 Jun 2020 17:31:21 +0000
(10:31 -0700)
committer
Alexander Vasarab <alexander@wylark.com>
Mon, 29 Jun 2020 17:31:21 +0000
(10:31 -0700)
munter/gui.py
patch
|
blob
|
history
diff --git
a/munter/gui.py
b/munter/gui.py
index fc5d82a9bf5ffbac5cbbd1a733e54589e86ab166..3642264d6ac8245bc1a04557877a265645d49801 100644
(file)
--- a/
munter/gui.py
+++ b/
munter/gui.py
@@
-152,13
+152,25
@@
class MainFrame(wx.Frame):
def update_distance(self, event):
value = self.te_distance.GetValue()
if value:
def update_distance(self, event):
value = self.te_distance.GetValue()
if value:
- self.props['distance'] = float(value)
+ try:
+ new_val = float(value)
+ self.props['distance'] = new_val
+ except:
+ # reset GUI to last-accepted val
+ self.te_distance.SetValue(str(self.props['distance']))
+ pass
self.update_mtc()
def update_elevation(self, event):
value = self.te_elevation.GetValue()
if value:
self.update_mtc()
def update_elevation(self, event):
value = self.te_elevation.GetValue()
if value:
- self.props['elevation'] = int(value)
+ try:
+ new_val = int(value)
+ self.props['elevation'] = new_val
+ except:
+ # reset GUI to last-accepted val
+ self.te_elevation.SetValue(str(self.props['elevation']))
+ pass
self.update_mtc()
def update_fitness(self, event):
self.update_mtc()
def update_fitness(self, event):