Changeset - 1546c423b467
[Not reviewed]
default
0 2 0
David McClosky - 20 years ago 2005-06-15 09:00:27
dmcc@bigasterisk.com
Fix bugs introduced in "SubClient created, keyboardcomposer and gyrocontroller use it now"
2 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
bin/gyrocontroller
Show inline comments
 
#!/usr/bin/env python
 
# vi: syntax=python
 

	
 
import run_local
 
from light9.Submaster import combine_subdict
 
from light9.Submaster import Submasters, combine_subdict
 
from light9.subclient import SubClient
 

	
 
class circcycle:
 
    """Like itertools.cycle, but with a prev() method too.  You lose
 
    all iterator benefits by using this, since it will store the whole
 
    sequence/iterator in memory.  Also, do not run this on an infinite
 
@@ -16,17 +16,17 @@ class circcycle:
 
    def __iter__(self):
 
        return self
 
    def change_index(self, delta):
 
        self.index = (self.index + delta) % len(self.sequence)
 
    def next(self):
 
        ret = self.sequence[self.index]
 
        self._change_index(1)
 
        self.change_index(1)
 
        return ret
 
    def prev(self):
 
        ret = self.sequence[self.index]
 
        self._change_index(-1)
 
        self.change_index(-1)
 
        return ret
 

	
 
class AbstractSimpleController(SubClient):
 
    """Simple controller with minimal input and output:
 
    
 
    Input is 4 directions and 3 buttons.
light9/subclient.py
Show inline comments
 
from light9 import dmxclient
 

	
 
# later, this stuff will talk to a SubServer
 
class SubClient:
 
    def __init__(self):
 
        pass # we may later need init code for network setup
 
    def get_levels_as_sub(self):
 
        """Subclasses must implement this method and return a Submaster
 
        object."""
 
    def get_dmx_list(self):
 
        maxes = self.get_levels_as_sub()
 
        return maxes.get_dmx_list()
0 comments (0 inline, 0 general)