Files
@ 5322639d61e9
Branch filter:
Location: light9/DataTypes/dmx.py - annotation
5322639d61e9
1.3 KiB
text/x-python
refactoring and little fixes in curvecalc and keyboardcomposer
font change in KC, cleanup of CC's main section, maybe some little
fixes that i can't remember because darcs doesn't show the changes
at the same time i'm writing this message
font change in KC, cleanup of CC's main section, maybe some little
fixes that i can't remember because darcs doesn't show the changes
at the same time i'm writing this message
45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 |
class DMX(list):
"""the signal that goes on a real-life dmx wire. it's up to 512
un-named channels each with a 8-bit value on each channel. this type
is useful for a DMXOut node or DMXLevelDisplay node. the channels are
stored in a python list where the first channel is at index 0. the
first channel in dmx terminology would be called channel 1."""
def __init__(self,dmxlevels):
if len(dmxlevels)>512:
raise TypeError("DMX objects can't have more than 512 channels")
list.extend(dmxlevels) # list.__init__ did't work right
def append(self,level):
if len(self)==512:
raise TypeError("DMX objects can't have more than 512 channels")
list.append(self,level)
def extend(self,levels):
if len(self)+len(levels)>512:
raise TypeError("DMX objects can't have more than 512 channels")
list.extend(self,levels)
def __setslice__(self,i,j,seq):
newlength = len(self)-(max(0,j)-max(0,i))+len(seq)
# we could check if newlength>512, but any length-changing slice is
# probably wrong for this datatype
if newlength!=len(self):
raise NotImplementedError("Different-length setslice would disturb DMX channels")
list.__setslice__(self,i,j,seq)
|