pass channel + cell indices to each class

update identifier properties to reflect changes.
This commit is contained in:
onyx-and-iris 2025-06-15 20:03:11 +01:00
parent c797912458
commit 714d2fc972

View File

@ -101,8 +101,7 @@ class BusEQ(IRemote):
kls,
{
'channel': tuple(
BusEQCh.make(remote, j)
for j in range(remote.kind.channels)
BusEQCh.make(remote, i, j) for j in range(remote.kind.channels)
)
},
)
@ -127,9 +126,10 @@ class BusEQ(IRemote):
def ab(self, val: bool):
self.setter('ab', 1 if val else 0)
class BusEQCh(IRemote):
@classmethod
def make(cls, remote, i):
def make(cls, remote, i, j):
"""
Factory method for Bus EQ channel.
@ -141,21 +141,29 @@ class BusEQCh(IRemote):
kls,
{
'cell': tuple(
BusEQChCell(remote, k)
for k in range(remote.kind.cells)
BusEQChCell(remote, i, j, k) for k in range(remote.kind.cells)
)
},
)
def __init__(self, remote, i, j):
super().__init__(remote, i)
self.channel_index = j
@property
def identifier(self) -> str:
return f'channel[{self.index}]'
return f'Bus[{self.index}].eq.channel[{self.channel_index}]'
class BusEQChCell(IRemote):
def __init__(self, remote, i, j, k):
super().__init__(remote, i)
self.channel_index = j
self.cell_index = k
@property
def identifier(self) -> str:
return f'cell[{self.index}]'
return f'Bus[{self.index}].eq.channel[{self.channel_index}].cell[{self.cell_index}]'
@property
def on(self) -> bool:
@ -197,6 +205,7 @@ class BusEQChCell(IRemote):
def q(self, val: float):
self.setter('q', val)
class PhysicalBus(Bus):
@classmethod
def make(cls, remote, i, kind):