From 09f052b4a3b17746810ad6ca56936d55d801f4d7 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 20 Sep 2023 10:40:09 +0100 Subject: [PATCH] defines slider mode nav events --- src/nvda_voicemeeter/window.py | 48 ++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index fd130e6..5dee12c 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -163,6 +163,13 @@ class NVDAVMWindow(psg.Window): self.bind("", "DENOISER MODE") self.bind("", "LIMIT MODE") + self.bind("", "LEFT") + self.bind("", "RIGHT") + self.bind("", "SHIFT-LEFT") + self.bind("", "SHIFT-RIGHT") + self.bind("", "CTRL-LEFT") + self.bind("", "CTRL-RIGHT") + # Hardware In for i in range(self.vm.kind.phys_in): self[f"HARDWARE IN||{i + 1}"].bind("", "||FOCUS IN") @@ -289,14 +296,13 @@ class NVDAVMWindow(psg.Window): self.nvda.speak(f"{mode} enabled") elif event == "Escape:27": if mode: - mode = None self.nvda.speak(f"{mode.split()[0]} mode disabled") + mode = None if mode: - if event == "Left:37": - self.write_event_value("SLIDER-MODE-LEFT", mode.split()[0]) - elif event == "Right:39": - self.write_event_value("SLIDER-MODE-RIGHT", mode.split()[0]) + if event in ("LEFT", "RIGHT", "SHIFT-LEFT", "SHIFT-RIGHT", "CTRL-LEFT", "CTRL-RIGHT"): + self.write_event_value(f"SLIDER-MODE-{event}", mode.split()[0]) + continue match parsed_cmd := self.parser.match.parseString(event): # Focus tabgroup @@ -382,6 +388,38 @@ class NVDAVMWindow(psg.Window): identifier, partial = focus.Key.split("||") if "SLIDER" not in partial: self.write_event_value(f"{identifier}||SLIDER {param}||KEY RIGHT", None) + case ["SLIDER-MODE-SHIFT-LEFT"]: + if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"): + continue + param = values[event] + if focus := self.find_element_with_focus(): + identifier, partial = focus.Key.split("||") + if "SLIDER" not in partial: + self.write_event_value(f"{identifier}||SLIDER {param}||KEY SHIFT LEFT", None) + case ["SLIDER-MODE-SHIFT-RIGHT"]: + if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"): + continue + param = values[event] + if focus := self.find_element_with_focus(): + identifier, partial = focus.Key.split("||") + if "SLIDER" not in partial: + self.write_event_value(f"{identifier}||SLIDER {param}||KEY SHIFT RIGHT", None) + case ["SLIDER-MODE-CTRL-LEFT"]: + if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"): + continue + param = values[event] + if focus := self.find_element_with_focus(): + identifier, partial = focus.Key.split("||") + if "SLIDER" not in partial: + self.write_event_value(f"{identifier}||SLIDER {param}||KEY CTRL LEFT", None) + case ["SLIDER-MODE-CTRL-RIGHT"]: + if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"): + continue + param = values[event] + if focus := self.find_element_with_focus(): + identifier, partial = focus.Key.split("||") + if "SLIDER" not in partial: + self.write_event_value(f"{identifier}||SLIDER {param}||KEY CTRL RIGHT", None) # Rename popups case ["F2:113"]: