hardware outs cache implemented

This commit is contained in:
onyx-and-iris 2023-09-05 16:10:54 +01:00
parent 749406afec
commit 5995ecbb4a
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,5 @@
def _make_hardware_outs_cache(vm) -> dict:
pass
return {**{f"HARDWARE OUT||A{i + 1}": vm.bus[i].device.name for i in range(vm.kind.phys_out)}}
def _make_output_cache(vm) -> dict:

View File

@ -39,6 +39,7 @@ class NVDAVMWindow(psg.Window):
self.kind = self.vm.kind
self.logger = logger.getChild(type(self).__name__)
self.cache = {
"hw_outs": _make_hardware_outs_cache(self.vm),
"outputs": _make_output_cache(self.vm),
"busmode": _make_bus_mode_cache(self.vm),
"labels": _make_label_cache(self.vm),
@ -91,6 +92,7 @@ class NVDAVMWindow(psg.Window):
def on_pdirty(self):
self.cache = {
"hw_outs": _make_hardware_outs_cache(self.vm),
"outputs": _make_output_cache(self.vm),
"busmode": _make_bus_mode_cache(self.vm),
"labels": _make_label_cache(self.vm),
@ -382,7 +384,7 @@ class NVDAVMWindow(psg.Window):
f"HARDWARE OUT {key} set {phonetic.get(driver, driver)} {device_name}",
)
case [["HARDWARE", "OUT"], [key], ["FOCUS", "IN"]]:
self.nvda.speak(f"HARDWARE OUT {key} {self.vm.bus[int(key[-1]) - 1].device.name}")
self.nvda.speak(f"HARDWARE OUT {key} {self.cache['hw_outs'][f'HARDWARE OUT||{key}']}")
case [["HARDWARE", "OUT"], [key], ["KEY", "SPACE" | "ENTER"]]:
open_context_menu_for_buttonmenu(self, f"HARDWARE OUT||{key}")