refactor make_row2

This commit is contained in:
onyx-and-iris 2023-08-24 17:22:37 +01:00
parent 7d02921626
commit aecc9efb83

View File

@ -83,77 +83,29 @@ class Builder:
def make_row2(self) -> psg.Frame: def make_row2(self) -> psg.Frame:
def add_insert_checkboxes(layout, i): def add_insert_checkboxes(layout, i):
if i <= self.kind.phys_in: if i <= self.kind.phys_in:
layout.append( [
[ layout.append(
psg.Checkbox( [
text="LEFT", psg.Checkbox(
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 0, i)].on, text=channel,
enable_events=True, default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
key=f"INSERT CHECKBOX||IN{i} 0", enable_events=True,
) key=f"INSERT CHECKBOX||IN{i} {j}",
], )
) ],
layout.append( )
[ for j, channel in enumerate(("LEFT", "RIGHT"))
psg.Checkbox( ]
text="RIGHT",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 1, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 1",
)
],
)
else: else:
layout.append( layout.append(
[ [
psg.Checkbox( psg.Checkbox(
text="LEFT", text=channel,
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 0, i)].on, default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
enable_events=True, enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 0", key=f"INSERT CHECKBOX||IN{i} {j}",
), )
psg.Checkbox( for j, channel in enumerate(("LEFT", "RIGHT", "C", "LFE", "SL", "SR", "BL", "BR"))
text="RIGHT",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 1, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 1",
),
psg.Checkbox(
text="C",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 2, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 2",
),
psg.Checkbox(
text="LFE",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 3, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 3",
),
psg.Checkbox(
text="SL",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 4, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 4",
),
psg.Checkbox(
text="SR",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 5, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 5",
),
psg.Checkbox(
text="BL",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 6, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 6",
),
psg.Checkbox(
text="BR",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 7, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 7",
),
], ],
) )