implements tabs physical strip, virtual strip

output buttons are laid out and events are defined
This commit is contained in:
onyx-and-iris 2023-08-25 22:25:30 +01:00
parent 2490fc9343
commit fafe9ea4d6
2 changed files with 67 additions and 24 deletions

View File

@ -17,38 +17,27 @@ class Builder:
self.kind = self.vm.kind self.kind = self.vm.kind
def run(self) -> list: def run(self) -> list:
layout = [] layout0 = []
if self.kind.name == "basic": if self.kind.name == "basic":
steps = (self.make_tab0_row0,) steps = (self.make_tab0_row0,)
else: else:
steps = (self.make_tab0_row0, self.make_tab0_row1, self.make_tab0_row2, self.make_tab0_row3) steps = (self.make_tab0_row0, self.make_tab0_row1, self.make_tab0_row2, self.make_tab0_row3)
for step in steps: for step in steps:
layout.append([step()]) layout0.append([step()])
# dummy layouts layout1 = []
layout2 = [ steps = (self.make_tab1_rows,)
[ for step in steps:
psg.Button( layout1.append([step()])
f"1",
size=(6, 3),
key=f"ZA BUTTON||1",
)
]
]
layout3 = [ layout2 = []
[ steps = (self.make_tab2_rows,)
psg.Button( for step in steps:
f"2", layout2.append([step()])
size=(6, 3),
key=f"ZA BUTTON||2",
)
]
]
tab1 = psg.Tab("settings", layout) tab1 = psg.Tab("settings", layout0, key="settings")
tab2 = psg.Tab("physical strips", layout2) tab2 = psg.Tab("physical strips", layout1, key="physical strip")
tab3 = psg.Tab("virtual strips", layout3) tab3 = psg.Tab("virtual strips", layout2, key="virtual strip")
Tg = psg.TabGroup([[tab1, tab2, tab3]]) Tg = psg.TabGroup([[tab1, tab2, tab3]])
return [[Tg]] return [[Tg]]
@ -177,3 +166,49 @@ class Builder:
asio_checkboxes.insert(0, inner) asio_checkboxes.insert(0, inner)
return psg.Frame("PATCH INSERT", asio_checkboxes) return psg.Frame("PATCH INSERT", asio_checkboxes)
def make_tab1_row(self, i) -> psg.Frame:
def add_strip_outputs(layout):
layout.append(
[
psg.Button(
f"A{j + 1}" if j < self.kind.phys_out else f"B{j - self.kind.phys_out + 1}",
size=(4, 2),
key=f"STRIP {i}||A{j + 1}"
if j < self.kind.phys_out
else f"STRIP {i}||B{j - self.kind.phys_out + 1}",
)
for j in range(self.kind.num_strip)
]
)
outputs = list()
[step(outputs) for step in (add_strip_outputs,)]
return psg.Frame(self.vm.strip[i].label, outputs)
def make_tab1_rows(self) -> list:
layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_out)]
return psg.Frame(f"", layout)
def make_tab2_row(self, i) -> psg.Frame:
def add_strip_outputs(layout):
layout.append(
[
psg.Button(
f"A{j + 1}" if j < self.kind.phys_out else f"B{j - self.kind.phys_out + 1}",
size=(4, 2),
key=f"STRIP {i}||A{j + 1}"
if j < self.kind.phys_out
else f"STRIP {i}||B{j - self.kind.phys_out + 1}",
)
for j in range(self.kind.num_strip)
]
)
outputs = list()
[step(outputs) for step in (add_strip_outputs,)]
return psg.Frame(self.vm.strip[i].label, outputs)
def make_tab2_rows(self) -> list:
layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_out, self.kind.phys_out + self.kind.virt_out)]
return psg.Frame(f"", layout)

View File

@ -66,6 +66,13 @@ class NVDAVMWindow(psg.Window):
else: else:
[self[f"INSERT CHECKBOX||IN{i + 1} {j}"].bind("<FocusIn>", "||FOCUS IN") for j in range(8)] [self[f"INSERT CHECKBOX||IN{i + 1} {j}"].bind("<FocusIn>", "||FOCUS IN") for j in range(8)]
# Strip Outputs
for i in range(self.kind.num_strip):
for j in range(self.kind.phys_out):
self[f"STRIP {i}||A{j + 1}"].bind("<FocusIn>", "||FOCUS IN")
for j in range(self.kind.virt_out):
self[f"STRIP {i}||B{j + 1}"].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
@ -75,6 +82,7 @@ class NVDAVMWindow(psg.Window):
while True: while True:
event, values = self.read() event, values = self.read()
self.logger.debug(f"event::{event}\nvalues::{values}")
if event in (psg.WIN_CLOSED, "Exit"): if event in (psg.WIN_CLOSED, "Exit"):
break break
match parsed_cmd := self.parser.match.parseString(event): match parsed_cmd := self.parser.match.parseString(event):