mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2024-11-22 18:00:50 +00:00
implements:
buses tab composite buttons bus composite events
This commit is contained in:
parent
ddbb339810
commit
e1fb16c32b
@ -37,10 +37,16 @@ class Builder:
|
|||||||
for step in steps:
|
for step in steps:
|
||||||
layout2.append([step()])
|
layout2.append([step()])
|
||||||
|
|
||||||
|
layout3 = []
|
||||||
|
steps = (self.make_tab3_rows,)
|
||||||
|
for step in steps:
|
||||||
|
layout3.append([step()])
|
||||||
|
|
||||||
tab1 = psg.Tab("Settings", layout0, key="settings")
|
tab1 = psg.Tab("Settings", layout0, key="settings")
|
||||||
tab2 = psg.Tab("Physical Strips", layout1, key="physical strip")
|
tab2 = psg.Tab("Physical Strips", layout1, key="physical strip")
|
||||||
tab3 = psg.Tab("Virtual Strips", layout2, key="virtual strip")
|
tab3 = psg.Tab("Virtual Strips", layout2, key="virtual strip")
|
||||||
tab_group = psg.TabGroup([[tab1, tab2, tab3]], change_submits=True, key="tabs")
|
tab4 = psg.Tab("Buses", layout3, key="buses")
|
||||||
|
tab_group = psg.TabGroup([[tab1, tab2, tab3, tab4]], change_submits=True, key="tabs")
|
||||||
|
|
||||||
return [[menu], [tab_group]]
|
return [[menu], [tab_group]]
|
||||||
|
|
||||||
@ -227,5 +233,17 @@ class Builder:
|
|||||||
return psg.Frame(self.vm.strip[i].label, outputs)
|
return psg.Frame(self.vm.strip[i].label, outputs)
|
||||||
|
|
||||||
def make_tab2_rows(self) -> psg.Frame:
|
def make_tab2_rows(self) -> psg.Frame:
|
||||||
layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)]
|
layout = [[self.make_tab2_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)]
|
||||||
|
return psg.Frame(None, layout, border_width=0)
|
||||||
|
|
||||||
|
def make_tab3_row(self, i):
|
||||||
|
def add_strip_outputs(layout):
|
||||||
|
layout.append([psg.Button(f"COMPOSITE", size=(16, 2), key=f"BUS {i}||COMPOSITE")])
|
||||||
|
|
||||||
|
buses = list()
|
||||||
|
[step(buses) for step in (add_strip_outputs,)]
|
||||||
|
return psg.Frame(self.vm.bus[i].label, buses)
|
||||||
|
|
||||||
|
def make_tab3_rows(self):
|
||||||
|
layout = [[self.make_tab3_row(i)] for i in range(self.kind.num_bus)]
|
||||||
return psg.Frame(None, layout, border_width=0)
|
return psg.Frame(None, layout, border_width=0)
|
||||||
|
@ -26,6 +26,10 @@ def _make_output_cache(vm) -> dict:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _make_bus_mode_cache(vm) -> dict:
|
||||||
|
return {**{f"BUS {i}||COMPOSITE": vm.bus[i].mode.get() for i in range(vm.kind.num_bus)}}
|
||||||
|
|
||||||
|
|
||||||
_patch_insert_channels = (
|
_patch_insert_channels = (
|
||||||
"left",
|
"left",
|
||||||
"right",
|
"right",
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
import PySimpleGUI as psg
|
import PySimpleGUI as psg
|
||||||
|
|
||||||
from .builder import Builder
|
from .builder import Builder
|
||||||
from .models import _make_output_cache, _patch_insert_channels
|
from .models import _make_bus_mode_cache, _make_output_cache, _patch_insert_channels
|
||||||
from .nvda import Nvda
|
from .nvda import Nvda
|
||||||
from .parser import Parser
|
from .parser import Parser
|
||||||
from .util import (
|
from .util import (
|
||||||
@ -24,7 +24,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.kind = self.vm.kind
|
self.kind = self.vm.kind
|
||||||
self.logger = logger.getChild(type(self).__name__)
|
self.logger = logger.getChild(type(self).__name__)
|
||||||
self.cache = {"outputs": _make_output_cache(self.vm)}
|
self.cache = {"outputs": _make_output_cache(self.vm), "busmode": _make_bus_mode_cache(self.vm)}
|
||||||
self.nvda = Nvda()
|
self.nvda = Nvda()
|
||||||
self.parser = Parser()
|
self.parser = Parser()
|
||||||
self.builder = Builder(self)
|
self.builder = Builder(self)
|
||||||
@ -79,6 +79,10 @@ class NVDAVMWindow(psg.Window):
|
|||||||
for j in range(self.kind.virt_out):
|
for j in range(self.kind.virt_out):
|
||||||
self[f"STRIP {i}||B{j + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
self[f"STRIP {i}||B{j + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
||||||
|
|
||||||
|
# Bus Composites
|
||||||
|
for j in range(self.kind.num_bus):
|
||||||
|
self[f"BUS {i}||COMPOSITE"].bind("<FocusIn>", "||FOCUS IN")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Parses the event string and matches it to events
|
Parses the event string and matches it to events
|
||||||
@ -200,6 +204,29 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val = self.cache["outputs"][f"STRIP {index}||{output}"]
|
val = self.cache["outputs"][f"STRIP {index}||{output}"]
|
||||||
label = self.vm.strip[int(index)].label
|
label = self.vm.strip[int(index)].label
|
||||||
self.nvda.speak(f"STRIP {index} {output} {label if label else ''} {'on' if val else 'off'}")
|
self.nvda.speak(f"STRIP {index} {output} {label if label else ''} {'on' if val else 'off'}")
|
||||||
|
|
||||||
|
# Bus composite
|
||||||
|
case [["BUS", index], ["COMPOSITE"]]:
|
||||||
|
val = self.cache["busmode"][event]
|
||||||
|
if val != "normal":
|
||||||
|
self.vm.bus[int(index)].mode.normal = True
|
||||||
|
self.cache["busmode"][event] = "normal"
|
||||||
|
else:
|
||||||
|
self.vm.bus[int(index)].mode.composite = True
|
||||||
|
self.cache["busmode"][event] = "composite"
|
||||||
|
label = self.vm.bus[int(index)].label
|
||||||
|
self.TKroot.after(
|
||||||
|
200,
|
||||||
|
self.nvda.speak,
|
||||||
|
f"BUS {index} {label if label else ''} bus mode {self.cache['busmode'][event]}",
|
||||||
|
)
|
||||||
|
case [["BUS", index], ["COMPOSITE"], ["FOCUS", "IN"]]:
|
||||||
|
label = self.vm.bus[int(index)].label
|
||||||
|
self.nvda.speak(
|
||||||
|
f"BUS {index} {label if label else ''} bus mode {self.cache['busmode'][f'BUS {index}||COMPOSITE']}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Unknown
|
||||||
case _:
|
case _:
|
||||||
self.logger.error(f"Unknown event {event}")
|
self.logger.error(f"Unknown event {event}")
|
||||||
self.logger.debug(f"parsed::{parsed_cmd}")
|
self.logger.debug(f"parsed::{parsed_cmd}")
|
||||||
|
Loading…
Reference in New Issue
Block a user