query values dict

instead of making redundant api calls
This commit is contained in:
onyx-and-iris 2023-08-25 18:52:26 +01:00
parent e4e372e84a
commit c308a8fd07

View File

@ -95,10 +95,11 @@ class Window(psg.Window):
channel = ("left", "right")[int(channel)] channel = ("left", "right")[int(channel)]
self.nvda.speak(f"Patch ASIO {in_num} {channel} set to {val}") self.nvda.speak(f"Patch ASIO {in_num} {channel} set to {val}")
case [["ASIO", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]: case [["ASIO", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
index = get_asio_checkbox_index(int(channel), int(in_num[-1])) index = get_asio_checkbox_index(int(channel), int(in_num[-1]))
channel = ("left", "right")[int(channel)] channel = ("left", "right")[int(channel)]
num = int(in_num[-1]) num = int(in_num[-1])
self.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {self.vm.patch.asio[index].get()}") self.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {val}")
case [["INSERT", "CHECKBOX"], [in_num, channel]]: case [["INSERT", "CHECKBOX"], [in_num, channel]]:
index = get_insert_checkbox_index( index = get_insert_checkbox_index(
self.kind, self.kind,
@ -116,11 +117,10 @@ class Window(psg.Window):
int(channel), int(channel),
int(in_num[-1]), int(in_num[-1]),
) )
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
channel = _patch_insert_channels[int(channel)] channel = _patch_insert_channels[int(channel)]
num = int(in_num[-1]) num = int(in_num[-1])
self.nvda.speak( self.nvda.speak(f"Patch INSERT IN#{num} {channel} {'on' if val else 'off'}")
f"Patch INSERT IN#{num} {channel} {'on' if self.vm.patch.insert[index].on else 'off'}"
)
case _: case _:
self.logger.error(f"Unknown event {event}") self.logger.error(f"Unknown event {event}")
self.logger.debug(parsed_cmd) self.logger.debug(parsed_cmd)