Mercurial > code > home > repos > light9
changeset 1633:eccbc249fee7
fix KC launch bug. log corrupt settings and move on.
Ignore-this: 343e3a38e37b281cf807172f75aece87
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sat, 10 Jun 2017 03:11:57 +0000 |
parents | a0fc6f957323 |
children | 1f17634e0411 |
files | bin/keyboardcomposer light9/effect/effecteval.py |
diffstat | 2 files changed, 19 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/keyboardcomposer Sat Jun 10 02:07:39 2017 +0000 +++ b/bin/keyboardcomposer Sat Jun 10 03:11:57 2017 +0000 @@ -21,6 +21,7 @@ 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 @@ 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 @@ 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
--- a/light9/effect/effecteval.py Sat Jun 10 02:07:39 2017 +0000 +++ b/light9/effect/effecteval.py Sat Jun 10 03:11:57 2017 +0000 @@ -5,6 +5,7 @@ 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 @@ 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)))