Ejemplo n.º 1
0
 def white(self, grp):
     """white(grp)
     sets all lights in grp to white
     grp:
     0 = All
     1 - 4 corresponding groups
     """
     self.grp_ctrl(grp, True)
     write(WHITE[grp])
Ejemplo n.º 2
0
 def color(self, grp, color):
     """color(grp,color)
     sets the color of grp to color
     grp:
     0 = All
     1 - 4 corresponding groups
     color:
     0<=color<=255
     """
     self.grp_ctrl(grp, True)
     if color > 0 and color < 256:
         write(chr(64)+chr(color))
     else:
         # should probably throw an exception
         if color <= 0:
             write(chr(64)+chr(0))
         else:
             write(chr(64)+chr(255))
Ejemplo n.º 3
0
 def brightness(self, grp, luminosity):
     """brightness(grp,luminosity)
     sets the brightness of grp to luminosity
     grp:
     0 = All
     1 - 4 corresponding groups
     luminosity:
     1<=luminosity<=25
     """
     self.grp_ctrl(grp, True)
     if luminosity > 0 and luminosity < 26:
         write(chr(78)+chr(luminosity+2))
     else:
         # shold probably throw an exception
         if luminosity <= 0:
             write(chr(78)+chr(2))
         else:
             write(chr(78)+chr(27))
Ejemplo n.º 4
0
 def grp_ctrl(self, grp, state):
     """grp_ctrl(grp,state)
     switches on grp
     grp:
     0 = All
     1 - 4 corresponding groups
     state:
     True for on, False for off
     """
     if grp == 0:
         if state:
             write(ALL_ON)
         else:
             write(ALL_OFF)
     if grp == 1:
         if state:
             write(GRP1_ON)
         else:
             write(GRP1_OFF)
     elif grp == 2:
         if state:
             write(GRP2_ON)
         else:
             write(GRP2_OFF)
     elif grp == 3:
         if state:
             write(GRP3_ON)
         else:
             write(GRP3_OFF)
     elif grp == 4:
         if state:
             write(GRP4_ON)
         else:
             write(GRP4_OFF)