|
@@ -173,8 +173,9 @@ class VulcanBoardApp(App):
|
|
|
async def execute_command_async(self, button: dict, btn: AutoResizeButton):
|
|
async def execute_command_async(self, button: dict, btn: AutoResizeButton):
|
|
|
follow_up_state_loop = True
|
|
follow_up_state_loop = True
|
|
|
states = button["states"]
|
|
states = button["states"]
|
|
|
|
|
+ current_state_id = btn.state_id
|
|
|
while follow_up_state_loop:
|
|
while follow_up_state_loop:
|
|
|
- state = get_state_from_id(states, btn.state_id)
|
|
|
|
|
|
|
+ state = get_state_from_id(states, current_state_id)
|
|
|
follow_up_state_loop = False
|
|
follow_up_state_loop = False
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -188,15 +189,29 @@ class VulcanBoardApp(App):
|
|
|
log(f"Error executing command: {e}", color="yellow")
|
|
log(f"Error executing command: {e}", color="yellow")
|
|
|
|
|
|
|
|
if len(states) != 1:
|
|
if len(states) != 1:
|
|
|
- if isinstance(
|
|
|
|
|
- follow_up_state := state.get("follow_up_state"), int
|
|
|
|
|
- ):
|
|
|
|
|
|
|
+ follow_up_state = state.get("follow_up_state")
|
|
|
|
|
+ if isinstance(follow_up_state, int):
|
|
|
follow_up_state_loop = True
|
|
follow_up_state_loop = True
|
|
|
exit_code = follow_up_state
|
|
exit_code = follow_up_state
|
|
|
|
|
+ elif follow_up_state == "exit_code":
|
|
|
|
|
+ follow_up_state_loop = True
|
|
|
|
|
+
|
|
|
|
|
+ if follow_up_state_loop:
|
|
|
|
|
+ current_state_id = get_state_id_from_exit_code(
|
|
|
|
|
+ states, exit_code
|
|
|
|
|
+ )
|
|
|
|
|
+ follow_up_execute_states = state.get(
|
|
|
|
|
+ "follow_up_execute_states"
|
|
|
|
|
+ )
|
|
|
|
|
+ if (
|
|
|
|
|
+ follow_up_execute_states is not None
|
|
|
|
|
+ and current_state_id not in follow_up_execute_states
|
|
|
|
|
+ ):
|
|
|
|
|
+ follow_up_state_loop = False
|
|
|
|
|
|
|
|
Clock.schedule_once(
|
|
Clock.schedule_once(
|
|
|
- lambda _: self.update_button_feedback(
|
|
|
|
|
- states, btn, exit_code
|
|
|
|
|
|
|
+ lambda _, ec=exit_code: self.update_button_feedback(
|
|
|
|
|
+ states, btn, ec
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
affects_buttons = button.get("affects_buttons", None)
|
|
affects_buttons = button.get("affects_buttons", None)
|
|
@@ -205,10 +220,10 @@ class VulcanBoardApp(App):
|
|
|
btn_pos = (affected_btn_dims[0], affected_btn_dims[1])
|
|
btn_pos = (affected_btn_dims[0], affected_btn_dims[1])
|
|
|
affected_button = self.button_grid[btn_pos]
|
|
affected_button = self.button_grid[btn_pos]
|
|
|
Clock.schedule_once(
|
|
Clock.schedule_once(
|
|
|
- lambda _, btn_pos=btn_pos, affected_button=affected_button: self.update_button_feedback(
|
|
|
|
|
|
|
+ lambda _, btn_pos=btn_pos, affected_button=affected_button, ec=exit_code: self.update_button_feedback(
|
|
|
self.button_config_map[btn_pos]["states"],
|
|
self.button_config_map[btn_pos]["states"],
|
|
|
affected_button,
|
|
affected_button,
|
|
|
- exit_code,
|
|
|
|
|
|
|
+ ec,
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
|
|
|