adds enter bind for BUSMODE buttons

This commit is contained in:
onyx-and-iris 2023-09-04 07:40:14 +01:00
parent 5cc8f1ae3d
commit 5cd4342b47

View File

@ -54,14 +54,14 @@ class NVDAVMWindow(psg.Window):
try: try:
with open(default_config, "r") as f: with open(default_config, "r") as f:
data = json.load(f) data = json.load(f)
config = data["default_config"] configpath = Path(data["default_config"])
if Path(config).exists(): if configpath.exists():
self.vm.set("command.load", config) self.vm.set("command.load", str(configpath))
self.logger.debug(f"config {config} loaded") self.logger.debug(f"config {configpath} loaded")
self.TKroot.after( self.TKroot.after(
200, 200,
self.nvda.speak, self.nvda.speak,
f"config {Path(config).stem} has been loaded", f"config {configpath.stem} has been loaded",
) )
except json.JSONDecodeError: except json.JSONDecodeError:
self.logger.debug("no data in settings.json. silently continuing...") self.logger.debug("no data in settings.json. silently continuing...")
@ -119,6 +119,7 @@ class NVDAVMWindow(psg.Window):
# Bus Modes # Bus Modes
for i in range(self.kind.num_bus): for i in range(self.kind.num_bus):
self[f"BUS {i}||MODE"].bind("<FocusIn>", "||FOCUS IN") self[f"BUS {i}||MODE"].bind("<FocusIn>", "||FOCUS IN")
self[f"BUS {i}||MODE"].bind("<Return>", "||KEY ENTER")
# ASIO Buffer # ASIO Buffer
if self.kind.name != "basic": if self.kind.name != "basic":
@ -440,6 +441,8 @@ class NVDAVMWindow(psg.Window):
case [["BUS", index], ["MODE"], ["FOCUS", "IN"]]: case [["BUS", index], ["MODE"], ["FOCUS", "IN"]]:
label = self.cache["labels"]["bus"][f"BUS {index}||LABEL"] label = self.cache["labels"]["bus"][f"BUS {index}||LABEL"]
self.nvda.speak(f"{label} bus mode {self.cache['busmode'][f'BUS {index}||MODE']}") self.nvda.speak(f"{label} bus mode {self.cache['busmode'][f'BUS {index}||MODE']}")
case [["BUS", index], ["MODE"], ["KEY", "ENTER"]]:
self.find_element_with_focus().click()
# Unknown # Unknown
case _: case _: