Skip to content

Commit

Permalink
Caught RuntimeError. (#428) (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC authored Oct 3, 2024
1 parent d7cc28d commit 583dec6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions leads_vec/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ def do(self) -> None:
class DirectionIndicatorSound(FrequencyGenerator):
@_override
def do(self) -> None:
if self._loops % 2 == 1:
DIRECTION_INDICATOR_ON.play()
else:
DIRECTION_INDICATOR_OFF.play()
try:
if self._loops % 2 == 1:
DIRECTION_INDICATOR_ON.play()
else:
DIRECTION_INDICATOR_OFF.play()
except RuntimeError as e:
L.error(repr(e))

def render(manager: ContextManager) -> None:
m1_widgets = (
Expand Down Expand Up @@ -227,7 +230,10 @@ def render(manager: ContextManager) -> None:

def time_lap() -> None:
ctx.time_lap()
CONFIRM.play()
try:
CONFIRM.play()
except RuntimeError as e:
L.error(repr(e))

manager["time_lap"] = _Button(root, text="", image=Stopwatch(), command=time_lap)
manager["hazard"] = _Button(root, text="", image=Hazard(), command=lambda: ctx.hazard(not ctx.hazard()))
Expand All @@ -237,7 +243,10 @@ def switch_esc_mode(mode: str) -> None:
manager["esc"].configure(selected_color="green", selected_hover_color="green")
else:
manager["esc"].configure(selected_color="red", selected_hover_color="red")
WARNING.play()
try:
WARNING.play()
except RuntimeError as e:
L.error(repr(e))
ctx.esc_mode(esc_mode)
w.runtime_data().control_system_switch_changed = True

Expand Down

0 comments on commit 583dec6

Please sign in to comment.