Changeset - d01e21621975
[Not reviewed]
default
0 9 0
Drew Perttula - 6 years ago 2019-05-27 07:41:09
drewp@bigasterisk.com
9 files changed with 26 insertions and 11 deletions:
0 comments (0 inline, 0 general)
bin/collector
Show inline comments
 
@@ -29,7 +29,6 @@ from rdfdb.syncedgraph import SyncedGrap
 
from light9.collector.output import EnttecDmx, Udmx, DummyOutput  # noqa
 

	
 

	
 

	
 
class Updates(cyclone.websocket.WebSocketHandler):
 

	
 
    def connectionMade(self, *args, **kwargs):
bin/effecteval
Show inline comments
 
@@ -202,9 +202,9 @@ class SongEffectsEval(PrettyErrorHandler
 

	
 
    def get(self):
 
        song = URIRef(self.get_argument('song'))
 
        effects = effectsForSong(self.settings.graph, song) # noqa
 
        effects = effectsForSong(self.settings.graph, song)  # noqa
 
        raise NotImplementedError
 
        self.write(maxDict(effectDmxDict(e) for e in effects)) # noqa
 
        self.write(maxDict(effectDmxDict(e) for e in effects))  # noqa
 
        # return dmx dict for all effects in the song, already combined
 

	
 

	
bin/keyboardcomposer
Show inline comments
 
@@ -181,14 +181,19 @@ class SubmasterBox(tk.Frame):
 

	
 
class KeyboardComposer(tk.Frame, SubClient):
 

	
 
    def __init__(self, root: tk.Tk, graph: SyncedGraph, session: URIRef, hw_sliders=True):
 
    def __init__(self,
 
                 root: tk.Tk,
 
                 graph: SyncedGraph,
 
                 session: URIRef,
 
                 hw_sliders=True):
 
        tk.Frame.__init__(self, root, bg='black')
 
        SubClient.__init__(self)
 
        self.graph = graph
 
        self.session = session
 

	
 
        self.subbox: Dict[URIRef, SubmasterBox] = {}  # sub uri : SubmasterBox
 
        self.slider_table: Dict[Tuple[int, int], SubmasterBox] = {}  # coords : SubmasterBox
 
        self.slider_table: Dict[Tuple[int, int], SubmasterBox] = {
 
        }  # coords : SubmasterBox
 
        self.rows: List[tk.Frame] = []  # this holds Tk Frames for each row
 

	
 
        self.current_row = 0  # should come from session graph
light9/collector/collector_client.py
Show inline comments
 
@@ -11,6 +11,7 @@ log = logging.getLogger('coll_client')
 

	
 

	
 
class TwistedZmqClient(object):
 

	
 
    def __init__(self, service):
 
        zf = ZmqFactory()
 
        e = ZmqEndpoint('connect', 'tcp://%s:%s' % (service.host, service.port))
light9/collector/weblisteners.py
Show inline comments
 
import logging, traceback, time, json
 
log = logging.getLogger('weblisteners')
 

	
 

	
 
class WebListeners(object):
 

	
 
    def __init__(self):
light9/effect/sequencer.py
Show inline comments
 
@@ -56,7 +56,8 @@ class Note(object):
 
                self.getCurvePoints(curve, L9['strength'], originTime))
 
        self.points.sort()
 

	
 
    def getCurvePoints(self, curve, attr, originTime) -> List[Tuple[float, float]]:
 
    def getCurvePoints(self, curve, attr,
 
                       originTime) -> List[Tuple[float, float]]:
 
        points = []
 
        po = list(self.graph.predicate_objects(curve))
 
        if dict(po).get(L9['attr'], None) != attr:
 
@@ -131,7 +132,9 @@ class CodeWatcher(object):
 

	
 
class Sequencer(object):
 

	
 
    def __init__(self, graph: SyncedGraph, sendToCollector: Callable[[DeviceSettings], None],
 
    def __init__(self,
 
                 graph: SyncedGraph,
 
                 sendToCollector: Callable[[DeviceSettings], None],
 
                 fps=40):
 
        self.graph = graph
 
        self.fps = fps
light9/effect/settings.py
Show inline comments
 
@@ -12,6 +12,7 @@ log = logging.getLogger('settings')
 
from light9.collector.device import resolve
 
from typing import Sequence, Dict, Union, List
 

	
 

	
 
def parseHex(h):
 
    if h[0] != '#': raise ValueError(h)
 
    return [int(h[i:i + 2], 16) for i in (1, 3, 5)]
 
@@ -24,7 +25,7 @@ def parseHexNorm(h):
 
def toHex(rgbFloat: Sequence[float]) -> str:
 
    assert len(rgbFloat) == 3
 
    scaled = (max(0, min(255, int(v * 255))) for v in rgbFloat)
 
    return '#%02x%02x%02x' % tuple(scaled) # type: ignore
 
    return '#%02x%02x%02x' % tuple(scaled)  # type: ignore
 

	
 

	
 
def getVal(graph, subj):
 
@@ -43,7 +44,8 @@ class _Settings(object):
 

	
 
    def __init__(self, graph, settingsList):
 
        self.graph = graph  # for looking up all possible attrs
 
        self._compiled: Dict[URIRef, Dict[URIRef, Union[float, str]]] = {}  # dev: { attr: val }; val is number or colorhex
 
        self._compiled: Dict[URIRef, Dict[URIRef, Union[float, str]]] = {
 
        }  # dev: { attr: val }; val is number or colorhex
 
        for row in settingsList:
 
            self._compiled.setdefault(row[0], {})[row[1]] = row[2]
 
        # self._compiled may not be final yet- see _fromCompiled
light9/effect/simple_outputs.py
Show inline comments
 
@@ -4,13 +4,15 @@ from light9.effect.scale import scale
 
from typing import Dict, List, Tuple, Any
 
from rdflib import URIRef
 

	
 

	
 
class SimpleOutputs(object):
 

	
 
    def __init__(self, graph):
 
        self.graph = graph
 

	
 
        # effect : [(dev, attr, value, isScaled)]
 
        self.effectOutputs: Dict[URIRef, List[Tuple[URIRef, URIRef, Any, bool]]] = {}
 
        self.effectOutputs: Dict[URIRef, List[
 
            Tuple[URIRef, URIRef, Any, bool]]] = {}
 

	
 
        self.graph.addHandler(self.updateEffectsFromGraph)
 

	
light9/vidref/musictime.py
Show inline comments
 
@@ -126,6 +126,8 @@ class MusicTime(object):
 
        fetch(
 
            method=b'POST',
 
            url=networking.musicPlayer.path('time'),
 
            postdata=json.dumps({"t": t}).encode('utf8'),
 
            postdata=json.dumps({
 
                "t": t
 
            }).encode('utf8'),
 
            headers={b"content-type": [b"application/json"]},
 
        )
0 comments (0 inline, 0 general)