view DataTypes/dmxlevel.py @ 268:d5858e9fa689

keyboardcomposer destroy fix and cleanups - We were destroying KeyboardComposer a little too much. Fortunately, we weren't passing the right number of arguments, so this was merely an error. - About the TODO comment removed: we don't need to use combine_dict since Submaster logic will be changed entirely when we/if we move to a SubServer world and keyboard composer will not be the wiser.
author David McClosky <dmcc@bigasterisk.com>
date Fri, 17 Jun 2005 02:21:19 +0000
parents 45b12307c695
children
line wrap: on
line source

###

"""
Snippet 0x93.2b: example of outputting a special type

class DMXLevel(float):
  def __init__(self,f):
    self.value = min(max(0,f),255)
  ...
  def __get__(...) # maybe

output.dmxlevel = DMXLevel(300)
    
>>> print output.dmxlevel
    255

dmxlevel = DMXLevel(3)
dmxlevel += 800
d = d + 800

There's yer problem:
http://python.org/doc/current/ref/numeric-types.html#l2h-152

"""