utility methods and default values implemented

This commit is contained in:
onyx-and-iris 2023-08-23 00:27:37 +01:00
parent c0c0701ed8
commit d195c1cd97

View File

@ -1,5 +1,7 @@
import PySimpleGUI as psg
from .util import get_asio_checkbox_index, get_insert_checkbox_index
class Builder:
"""Responsible for building the Window layout"""
@ -25,6 +27,7 @@ class Builder:
devices,
size=(22, 4),
expand_x=True,
default_value=self.vm.bus[i - 1].device.name,
enable_events=True,
readonly=True,
key=f"HARDWARE OUT||A{i}",
@ -41,10 +44,26 @@ class Builder:
def add_asio_checkboxes(layout, i):
nums = list(range(99))
layout.append(
[psg.Spin(nums, initial_value=0, size=2, enable_events=True, key=f"ASIO CHECKBOX||IN{i} 0")],
[
psg.Spin(
nums,
initial_value=self.vm.patch.asio[get_asio_checkbox_index(0, i)].get(),
size=2,
enable_events=True,
key=f"ASIO CHECKBOX||IN{i} 0",
)
],
)
layout.append(
[psg.Spin(nums, initial_value=0, size=2, enable_events=True, key=f"ASIO CHECKBOX||IN{i} 1")],
[
psg.Spin(
nums,
initial_value=self.vm.patch.asio[get_asio_checkbox_index(1, i)].get(),
size=2,
enable_events=True,
key=f"ASIO CHECKBOX||IN{i} 1",
)
],
)
inner = list()
@ -60,22 +79,76 @@ class Builder:
def add_insert_checkboxes(layout, i):
if i <= self.kind.phys_in:
layout.append(
[psg.Checkbox(text="LEFT", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 0")],
[
psg.Checkbox(
text="LEFT",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 0, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 0",
)
],
)
layout.append(
[psg.Checkbox(text="RIGHT", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 1")],
[
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:
layout.append(
[
psg.Checkbox(text="LEFT", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 0"),
psg.Checkbox(text="RIGHT", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 1"),
psg.Checkbox(text="C", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 2"),
psg.Checkbox(text="LFE", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 3"),
psg.Checkbox(text="SL", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 4"),
psg.Checkbox(text="SR", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 5"),
psg.Checkbox(text="BL", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 6"),
psg.Checkbox(text="BR", enable_events=True, key=f"INSERT CHECKBOX||IN{i} 7"),
psg.Checkbox(
text="LEFT",
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, 0, i)].on,
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} 0",
),
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",
),
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",
),
],
)