num_strip_levels, num_bus_levels added to KindMaps

This commit is contained in:
onyx-and-iris 2023-07-25 16:22:47 +01:00
parent 77ba347e99
commit 9bf52b5c11
5 changed files with 14 additions and 6 deletions

View File

@ -110,6 +110,7 @@ class IRemote(metaclass=ABCMeta):
cmd += (f".{param}",) cmd += (f".{param}",)
return "".join(cmd) return "".join(cmd)
@property
@abstractmethod @abstractmethod
def identifier(self): def identifier(self):
pass pass

View File

@ -53,6 +53,14 @@ class KindMapClass(metaclass=SingletonType):
def num_bus(self): def num_bus(self):
return sum(self.outs) return sum(self.outs)
@property
def num_strip_levels(self) -> int:
return 2 * self.phys_in + 8 * self.virt_in
@property
def num_bus_levels(self) -> int:
return 8 * (self.phys_out + self.virt_out)
def __str__(self) -> str: def __str__(self) -> str:
return self.name.capitalize() return self.name.capitalize()

View File

@ -9,7 +9,7 @@ class MacroButton(IRemote):
@property @property
def identifier(self): def identifier(self):
return f"button[{self.index}]" return f"command.button[{self.index}]"
@property @property
def state(self) -> bool: def state(self) -> bool:

View File

@ -103,12 +103,12 @@ class VbanRtPacket:
@property @property
def inputlevels(self) -> tuple: def inputlevels(self) -> tuple:
"""returns the entire level array across all inputs for a kind""" """returns the entire level array across all inputs for a kind"""
return self.strip_levels[0 : (2 * self._kind.phys_in + 8 * self._kind.virt_in)] return self.strip_levels[0 : self._kind.num_strip_levels]
@property @property
def outputlevels(self) -> tuple: def outputlevels(self) -> tuple:
"""returns the entire level array across all outputs for a kind""" """returns the entire level array across all outputs for a kind"""
return self.bus_levels[0 : 8 * self._kind.num_bus] return self.bus_levels[0 : self._kind.num_bus_levels]
@property @property
def stripstate(self) -> tuple: def stripstate(self) -> tuple:

View File

@ -141,9 +141,8 @@ class Updater(threading.Thread):
self._remote.socks[Socket.response].bind( self._remote.socks[Socket.response].bind(
(socket.gethostbyname(socket.gethostname()), self._remote.port) (socket.gethostbyname(socket.gethostname()), self._remote.port)
) )
p_in, v_in = self._remote.kind.ins self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
self._remote._strip_comp = [False] * (2 * p_in + 8 * v_in) self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus * 8)
def run(self): def run(self):
""" """