qmsk/dmx/heads.py
changeset 88 c923295ee520
parent 84 9ebf1a2cee3a
child 95 478b9d0485aa
equal deleted inserted replaced
87:2179a4e28aba 88:c923295ee520
    75         'blue',
    75         'blue',
    76         'control',
    76         'control',
    77         'alpha',
    77         'alpha',
    78     ]
    78     ]
    79 
    79 
       
    80 
       
    81 class Universe (object) :
       
    82     """
       
    83         An universe of Heads for DMX output.
       
    84     """
       
    85 
       
    86     def __init__ (self, dmx, heads) :
       
    87         self.dmx = dmx
       
    88         self.heads = heads
       
    89 
       
    90     def __getitem__ (self, name) :
       
    91         return self.heads[name]
       
    92 
       
    93     def __iter__ (self) :
       
    94         return self.heads.iteritems()
       
    95 
       
    96     def update (self, head, attrs) :
       
    97         """
       
    98             Update per-head values..
       
    99         """
       
   100 
       
   101         for attr, value in attrs.iteritems():
       
   102             head[attr] = value
       
   103         
       
   104         # output
       
   105         self.dmx.set(head.channel, *head)
       
   106