Skip to content

Commit

Permalink
Merge pull request #72 from RamesTheGeneric/main
Browse files Browse the repository at this point in the history
Fixed bad typecheck in Calibration Tab
  • Loading branch information
dfgHiatus authored Dec 27, 2024
2 parents 8e642f3 + 7ec3f29 commit 3d1abea
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions BabbleApp/calib_settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,24 @@ def render(self, window, event, values):
for count2, element2 in enumerate(element1):
if values[element2] != "":
value = values[element2]
if is_valid_float_input(value):
if is_valid_float_input(value): # Returns true if a single decimal point. Therefore we need to make sure value can be converted to a float by assuming a dot implies a leading 0.
if value == ".":
valid_float = 0.
values[element2] = valid_float
window[element2].update(valid_float)
value = float(values[element2])
if float(self.array[count1][count2]) != value:
self.array[count1][count2] = value
changed = True
else:
value = float(value[:-1])
window[element2].update(value)
values[element2] = value
trimmed_value = value[:-1]
if trimmed_value == '': # If we get an empty string, don't try to convert to float.
window[element2].update(trimmed_value)
values[element2] = trimmed_value
else:
value = float(trimmed_value)
window[element2].update(value)
values[element2] = value

if event == self.gui_reset_min:
for count1, element1 in enumerate(self.shape):
Expand Down

0 comments on commit 3d1abea

Please sign in to comment.