defines slider mode nav events

This commit is contained in:
onyx-and-iris 2023-09-20 10:40:09 +01:00
parent 577f1fbdbb
commit 09f052b4a3

View File

@ -163,6 +163,13 @@ class NVDAVMWindow(psg.Window):
self.bind("<Control-d>", "DENOISER MODE") self.bind("<Control-d>", "DENOISER MODE")
self.bind("<Control-l>", "LIMIT MODE") self.bind("<Control-l>", "LIMIT MODE")
self.bind("<Alt-Left>", "LEFT")
self.bind("<Alt-Right>", "RIGHT")
self.bind("<Alt-Shift-KeyPress-Left>", "SHIFT-LEFT")
self.bind("<Alt-Shift-KeyPress-Right>", "SHIFT-RIGHT")
self.bind("<Alt-Control-KeyPress-Left>", "CTRL-LEFT")
self.bind("<Alt-Control-KeyPress-Right>", "CTRL-RIGHT")
# Hardware In # Hardware In
for i in range(self.vm.kind.phys_in): for i in range(self.vm.kind.phys_in):
self[f"HARDWARE IN||{i + 1}"].bind("<FocusIn>", "||FOCUS IN") self[f"HARDWARE IN||{i + 1}"].bind("<FocusIn>", "||FOCUS IN")
@ -289,14 +296,13 @@ class NVDAVMWindow(psg.Window):
self.nvda.speak(f"{mode} enabled") self.nvda.speak(f"{mode} enabled")
elif event == "Escape:27": elif event == "Escape:27":
if mode: if mode:
mode = None
self.nvda.speak(f"{mode.split()[0]} mode disabled") self.nvda.speak(f"{mode.split()[0]} mode disabled")
mode = None
if mode: if mode:
if event == "Left:37": if event in ("LEFT", "RIGHT", "SHIFT-LEFT", "SHIFT-RIGHT", "CTRL-LEFT", "CTRL-RIGHT"):
self.write_event_value("SLIDER-MODE-LEFT", mode.split()[0]) self.write_event_value(f"SLIDER-MODE-{event}", mode.split()[0])
elif event == "Right:39": continue
self.write_event_value("SLIDER-MODE-RIGHT", mode.split()[0])
match parsed_cmd := self.parser.match.parseString(event): match parsed_cmd := self.parser.match.parseString(event):
# Focus tabgroup # Focus tabgroup
@ -382,6 +388,38 @@ class NVDAVMWindow(psg.Window):
identifier, partial = focus.Key.split("||") identifier, partial = focus.Key.split("||")
if "SLIDER" not in partial: if "SLIDER" not in partial:
self.write_event_value(f"{identifier}||SLIDER {param}||KEY RIGHT", None) 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 # Rename popups
case ["F2:113"]: case ["F2:113"]: