mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2024-11-22 10:00:46 +00:00
implements focus tab group on
ctrl+tab and ctrl+shift+tab
This commit is contained in:
parent
c1fe70c387
commit
0bf333d23d
@ -6,6 +6,7 @@ from .util import (
|
|||||||
get_input_device_list,
|
get_input_device_list,
|
||||||
get_insert_checkbox_index,
|
get_insert_checkbox_index,
|
||||||
get_patch_composite_list,
|
get_patch_composite_list,
|
||||||
|
get_tabs_labels,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -49,11 +50,10 @@ class Builder:
|
|||||||
for step in steps:
|
for step in steps:
|
||||||
layout3.append([step()])
|
layout3.append([step()])
|
||||||
|
|
||||||
tab1 = psg.Tab("Settings", layout0, key="settings")
|
layouts = [layout0, layout1, layout2, layout3]
|
||||||
tab2 = psg.Tab("Physical Strips", layout1, key="physical strip")
|
|
||||||
tab3 = psg.Tab("Virtual Strips", layout2, key="virtual strip")
|
tabs = [psg.Tab(identifier, layouts[i], key=identifier) for i, identifier in enumerate(get_tabs_labels())]
|
||||||
tab4 = psg.Tab("Buses", layout3, key="buses")
|
tab_group = psg.TabGroup([tabs], change_submits=True, key="tabs")
|
||||||
tab_group = psg.TabGroup([[tab1, tab2, tab3, tab4]], change_submits=True, key="tabs")
|
|
||||||
|
|
||||||
return [[menu], [tab_group]]
|
return [[menu], [tab_group]]
|
||||||
|
|
||||||
|
@ -65,3 +65,7 @@ def get_asio_samples_list() -> list:
|
|||||||
"160",
|
"160",
|
||||||
"128",
|
"128",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_tabs_labels() -> list:
|
||||||
|
return ["Settings", "Physical Strip", "Virtual Strip", "Buses"]
|
||||||
|
@ -11,6 +11,7 @@ from .util import (
|
|||||||
get_asio_checkbox_index,
|
get_asio_checkbox_index,
|
||||||
get_insert_checkbox_index,
|
get_insert_checkbox_index,
|
||||||
get_patch_composite_list,
|
get_patch_composite_list,
|
||||||
|
get_tabs_labels,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -31,10 +32,13 @@ class NVDAVMWindow(psg.Window):
|
|||||||
self.builder = Builder(self)
|
self.builder = Builder(self)
|
||||||
layout = self.builder.run()
|
layout = self.builder.run()
|
||||||
super().__init__(title, layout, return_keyboard_events=True, finalize=True)
|
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":
|
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[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(**buttonmenu_opts) for i in range(self.kind.phys_out)]
|
||||||
self["ASIO BUFFER"].Widget.config(takefocus=1)
|
self["ASIO BUFFER"].Widget.config(**buttonmenu_opts)
|
||||||
|
self.bind("<Control-KeyPress-Tab>", "CTRL-TAB")
|
||||||
|
self.bind("<Control-Shift-KeyPress-Tab>", "CTRL-SHIFT-TAB")
|
||||||
self.register_events()
|
self.register_events()
|
||||||
self.current_focus = None
|
self.current_focus = None
|
||||||
|
|
||||||
@ -116,6 +120,12 @@ class NVDAVMWindow(psg.Window):
|
|||||||
case [" "]:
|
case [" "]:
|
||||||
self.current_focus = self.find_element_with_focus()
|
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
|
# Menus
|
||||||
case [["Restart", "Audio", "Engine"], ["MENU"]]:
|
case [["Restart", "Audio", "Engine"], ["MENU"]]:
|
||||||
self.perform_long_operation(self.vm.command.restart, "ENGINE RESTART||END")
|
self.perform_long_operation(self.vm.command.restart, "ENGINE RESTART||END")
|
||||||
|
Loading…
Reference in New Issue
Block a user