diff --git a/src/nvda_voicemeeter/builder.py b/src/nvda_voicemeeter/builder.py index e3ed3dc..3cfc647 100644 --- a/src/nvda_voicemeeter/builder.py +++ b/src/nvda_voicemeeter/builder.py @@ -6,6 +6,7 @@ from .util import ( get_input_device_list, get_insert_checkbox_index, get_patch_composite_list, + get_tabs_labels, ) @@ -49,11 +50,10 @@ class Builder: for step in steps: layout3.append([step()]) - tab1 = psg.Tab("Settings", layout0, key="settings") - tab2 = psg.Tab("Physical Strips", layout1, key="physical strip") - tab3 = psg.Tab("Virtual Strips", layout2, key="virtual strip") - tab4 = psg.Tab("Buses", layout3, key="buses") - tab_group = psg.TabGroup([[tab1, tab2, tab3, tab4]], change_submits=True, key="tabs") + layouts = [layout0, layout1, layout2, layout3] + + tabs = [psg.Tab(identifier, layouts[i], key=identifier) for i, identifier in enumerate(get_tabs_labels())] + tab_group = psg.TabGroup([tabs], change_submits=True, key="tabs") return [[menu], [tab_group]] diff --git a/src/nvda_voicemeeter/util.py b/src/nvda_voicemeeter/util.py index d62842f..2767dd5 100644 --- a/src/nvda_voicemeeter/util.py +++ b/src/nvda_voicemeeter/util.py @@ -65,3 +65,7 @@ def get_asio_samples_list() -> list: "160", "128", ] + + +def get_tabs_labels() -> list: + return ["Settings", "Physical Strip", "Virtual Strip", "Buses"] diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 8283be2..1126bdc 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -11,6 +11,7 @@ from .util import ( get_asio_checkbox_index, get_insert_checkbox_index, get_patch_composite_list, + get_tabs_labels, ) logger = logging.getLogger(__name__) @@ -31,10 +32,13 @@ class NVDAVMWindow(psg.Window): self.builder = Builder(self) layout = self.builder.run() super().__init__(title, layout, return_keyboard_events=True, finalize=True) - [self[f"HARDWARE OUT||A{i + 1}"].Widget.config(takefocus=1) for i in range(self.kind.phys_out)] + buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1} + [self[f"HARDWARE OUT||A{i + 1}"].Widget.config(**buttonmenu_opts) for i in range(self.kind.phys_out)] if self.kind.name != "basic": - [self[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(takefocus=1) for i in range(self.kind.phys_out)] - self["ASIO BUFFER"].Widget.config(takefocus=1) + [self[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(**buttonmenu_opts) for i in range(self.kind.phys_out)] + self["ASIO BUFFER"].Widget.config(**buttonmenu_opts) + self.bind("", "CTRL-TAB") + self.bind("", "CTRL-SHIFT-TAB") self.register_events() self.current_focus = None @@ -116,6 +120,12 @@ class NVDAVMWindow(psg.Window): case [" "]: self.current_focus = self.find_element_with_focus() + case ["CTRL-TAB"] | ["CTRL-SHIFT-TAB"]: + tab_labels = get_tabs_labels() + next_tab = tab_labels.index(values["tabs"]) + 1 + self.logger.debug(f"Setting tab {tab_labels[next_tab]} focus") + self["tabs"].set_focus() + # Menus case [["Restart", "Audio", "Engine"], ["MENU"]]: self.perform_long_operation(self.vm.command.restart, "ENGINE RESTART||END")