Skip to content

Commit

Permalink
gui: Fix spinbox ranges to include maximum value
Browse files Browse the repository at this point in the history
Set range of intensity spinboxes to 0-100 via range(0, 101).

Python treats range(0, 5) as [0, 1, 2, 3, 4], verifiable with...
> [num for num in range(0, 5)]

This fixes the maximum strength being limited to 99%.
  • Loading branch information
digitalf0x committed Jun 2, 2024
1 parent b5b7702 commit 0d5e8b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BridgeApp/app_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ def build_pattern_setting_layout(key: str, pattern_list: [str], pattern_config:
k=key + KEY_VIB_PATTERN, size=15, readonly=True, enable_events=True)],
[sg.Text("Strength:"),
sg.Text("Min:", pad=0),
sg.Spin([num for num in range(0, 100)], pattern_config.str_min, pad=0,
sg.Spin([num for num in range(0, 101)], pattern_config.str_min, pad=0,
key=key + KEY_VIB_STR_MIN, enable_events=True),
sg.Text("Max:", pad=0),
sg.Spin([num for num in range(0, 100)], pattern_config.str_max, pad=0,
sg.Spin([num for num in range(0, 101)], pattern_config.str_max, pad=0,
key=key + KEY_VIB_STR_MAX, enable_events=True)],
[sg.Text("Speed:", size=6, tooltip=speed_tooltip),
sg.Slider(range=(1, 32), size=(13, 10), default_value=pattern_config.speed, tooltip=speed_tooltip,
Expand Down Expand Up @@ -117,7 +117,7 @@ def tracker_row(self, tracker_id, tracker_serial, tracker_model):
sg.Button("Identify", k=(KEY_BTN_TEST, tracker_serial), tooltip="Send a 500ms pulse to the tracker")],
[sg.Text(" "),
sg.Text("Battery threshold:", tooltip="Disables vibration bellow this battery level"),
sg.Spin([num for num in range(0, 90)], battery_threshold, pad=0,
sg.Spin([num for num in range(0, 91)], battery_threshold, pad=0,
key=(KEY_BATTERY_THRESHOLD, tracker_serial), enable_events=True),
sg.Text("%", pad=0),
sg.VSeparator(),
Expand Down

0 comments on commit 0d5e8b7

Please sign in to comment.