Mercurial > code > home > repos > light9
changeset 93:d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
author | drewp |
---|---|
date | Sat, 13 Jul 2002 03:09:26 +0000 |
parents | 827a675131dc |
children | 29a8b23d8db5 |
files | light8/ExternalInput.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/light8/ExternalInput.py Sat Jul 13 03:01:42 2002 +0000 +++ b/light8/ExternalInput.py Sat Jul 13 03:09:26 2002 +0000 @@ -7,7 +7,12 @@ class NetSliderHandler(SocketServer.StreamRequestHandler): def handle(self): data = self.rfile.readline(1000) - currentlevels[:] = [float(x)/255 for x in list(data.split())] + currentlevels[:] = [round(self.bounds(float(x)/255),3) for x in list(data.split())] + def bounds(self,x): + # the last .1 both ways shall not do anything + x=x*1.1-.05 + x=min(1,max(0,x)) + return x def start_server(levelstorage=0): server = SocketServer.TCPServer(