Changeset - 430014be95ce
[Not reviewed]
default
0 3 0
Drew Perttula - 18 years ago 2007-06-15 18:06:46
drewp@bigasterisk.com
fix KC dummy mode
3 files changed with 14 insertions and 6 deletions:
0 comments (0 inline, 0 general)
bin/keyboardcomposer
Show inline comments
 
@@ -20,12 +20,16 @@ from bcf2000 import BCF2000
 

	
 
nudge_keys = {
 
    'up'   : list('qwertyui'),
 
    'down' : list('asdfghjk')
 
}
 

	
 
class DummySliders:
 
    def valueOut(self, name, value):
 
        pass
 

	
 
class SubScale(Scale, Fadable):
 
    def __init__(self, master, *args, **kw):
 
        self.scale_var = kw.get('variable') or DoubleVar()
 
        kw.update({'variable' : self.scale_var,
 
                   'from' : 1, 'to' : 0, 'showvalue' : 0,
 
                   'sliderlength' : 15, 'res' : 0.01,
 
@@ -111,16 +115,13 @@ class KeyboardComposer(Frame, SubClient)
 
        self.stop_frequent_update_time = 0
 

	
 
    def connect_to_hw(self, hw_sliders):
 
        if hw_sliders:
 
            self.sliders = Sliders(self.hw_slider_moved)
 
        else:
 
            class dummy:
 
                def valueOut(self, name, value):
 
                    pass
 
            self.sliders = dummy()
 
            self.sliders = DummySliders()
 

	
 
    def make_key_hints(self):
 
        keyhintrow = Frame(self)
 

	
 
        col = 0
 
        for upkey, downkey in zip(nudge_keys['up'],
 
@@ -228,12 +229,15 @@ class KeyboardComposer(Frame, SubClient)
 

	
 
            # initial position
 
            self.send_to_hw(sub.name, col + 1)
 
            col = (col + 1) % 8
 

	
 
    def send_to_hw(self, subName, hwNum):
 
        if isinstance(self.sliders, DummySliders):
 
            return
 
            
 
        v = round(127 * self.slider_vars[subName].get())
 
        chan = "slider%s" % hwNum
 
        
 
        # workaround for some rounding issue, where we receive one
 
        # value and then decide to send back a value that's one step
 
        # lower
light9/networking.py
Show inline comments
 
@@ -9,20 +9,20 @@ def dmxServerUrl():
 
    return "http://localhost:%s" % dmxServerPort()
 

	
 
def dmxServerPort():
 
    return 8030
 
    
 
def musicUrl():
 
    return "http://localhost:%s" % musicPort()
 
    return "http://score:%s" % musicPort()
 

	
 
def musicPort():
 
    return 8040
 

	
 
def mpdServer():
 
    """servername, port"""
 
    return os.getenv('LIGHT9_MPD_SERVER', 'dash'),6600
 
    return os.getenv('LIGHT9_MPD_SERVER', 'score'),6600
 

	
 
def kcPort():
 
    return 8050
 

	
 
def kcServer():
 
    return 'dash'
light9/showconfig.py
Show inline comments
 
@@ -6,12 +6,14 @@ from namespaces import MUS, L9
 

	
 
_config = (None, None, None) # graph, mtime, len
 
def getGraph():
 
    global _config
 
    configPath = path.join(root(), 'config.n3')
 
    
 
    # file patch.n3 mtime is not currently being checked
 
    
 
    now = time.time()
 
    diskMtime = path.getmtime(configPath)
 
    if diskMtime <= _config[1]:
 
        graph = _config[0]
 
        # i'm scared of some program modifying the graph, and then i
 
        # return that from a new getGraph call. Maybe I should be
 
@@ -19,12 +21,14 @@ def getGraph():
 
        # contexts
 
        assert len(graph) == _config[2]
 
        return _config[0]
 

	
 
    graph = Graph()
 
    graph.parse(configPath, format='n3')
 
    graph.parse(path.join(root(), "patch.n3"), format="n3")
 
    
 
    _config = (graph, diskMtime, len(graph))
 
    return graph
 

	
 
def root():
 
    r = getenv("LIGHT9_SHOW")
 
    if r is None:
0 comments (0 inline, 0 general)