Changeset - eccbc249fee7
[Not reviewed]
default
0 2 0
Drew Perttula - 8 years ago 2017-06-10 03:11:57
drewp@bigasterisk.com
fix KC launch bug. log corrupt settings and move on.
Ignore-this: 343e3a38e37b281cf807172f75aece87
2 files changed with 19 insertions and 13 deletions:
0 comments (0 inline, 0 general)
bin/keyboardcomposer
Show inline comments
 
@@ -21,6 +21,7 @@ from light9.rdfdb import clientsession
 
from light9.rdfdb.syncedgraph import SyncedGraph
 
from light9.effect.sequencer import CodeWatcher
 
import light9.effect.effecteval
 
from light9.effect.settings import DeviceSettings
 

	
 
from bcf2000 import BCF2000
 

	
 
@@ -69,7 +70,7 @@ class SubmasterBox(tk.Frame):
 
        bg = self.graph.value(sub, L9.color, default='#000000')
 
        rgb = webcolors.hex_to_rgb(bg)
 
        hsv = colorsys.rgb_to_hsv(*[x/255 for x in rgb])
 
        darkBg = webcolors.rgb_to_hex(tuple([x * 255 for x in colorsys.hsv_to_rgb(
 
        darkBg = webcolors.rgb_to_hex(tuple([int(x * 255) for x in colorsys.hsv_to_rgb(
 
            hsv[0], hsv[1], .2)]))
 
        tk.Frame.__init__(self, master, bd=1, relief='raised', bg=bg)
 
        self.name = self.graph.label(sub)
 
@@ -457,14 +458,14 @@ class KeyboardComposer(tk.Frame, SubClie
 
            strength = graph.value(setting, L9['level'])
 
            if strength:
 
                now = time.time()
 
                outputSettings.extend(
 
                outputSettings.append(
 
                    self.effectEval[effect].outputFromEffect(
 
                        [(L9['strength'], strength)],
 
                        songTime=now,
 
                        # should be counting from when you bumped up from 0
 
                        noteTime=now))
 

	
 
        return outputSettings
 
        return DeviceSettings.fromList(graph, outputSettings)
 

	
 
    def save_current_stage(self, subname):
 
        raise NotImplementedError
light9/effect/effecteval.py
Show inline comments
 
@@ -5,6 +5,7 @@ from webcolors import rgb_to_hex, hex_to
 
from colorsys import hsv_to_rgb
 
from decimal import Decimal
 
import math
 
import traceback
 
from noise import pnoise1
 
import logging
 
import time
 
@@ -71,16 +72,20 @@ class EffectEval(object):
 
        for effect in self.graph.subjects(RDF.type, L9['Effect']):
 
            settings = []
 
            for setting in self.graph.objects(effect, L9['setting']):
 
                d = self.graph.value(setting, L9['device'])
 
                a = self.graph.value(setting, L9['deviceAttr'])
 
                v = self.graph.value(setting, L9['value'])
 
                sv = self.graph.value(setting, L9['scaledValue'])
 
                if not (bool(v) ^ bool(sv)):
 
                    raise NotImplementedError
 
                if d is None:
 
                    raise TypeError('no device on %s' % effect)
 
                if a is None:
 
                    raise TypeError('no attr on %s' % effect)
 
                try:
 
                    d = self.graph.value(setting, L9['device'])
 
                    a = self.graph.value(setting, L9['deviceAttr'])
 
                    v = self.graph.value(setting, L9['value'])
 
                    sv = self.graph.value(setting, L9['scaledValue'])
 
                    if not (bool(v) ^ bool(sv)):
 
                        raise NotImplementedError('no value for %s' % setting)
 
                    if d is None:
 
                        raise TypeError('no device on %s' % effect)
 
                    if a is None:
 
                        raise TypeError('no attr on %s' % effect)
 
                except Exception:
 
                    traceback.print_exc()
 
                    continue
 

	
 
                settings.append((d, a, v if v is not None else sv, bool(sv)))
 

	
0 comments (0 inline, 0 general)