diff --git a/bin/collector b/bin/collector --- a/bin/collector +++ b/bin/collector @@ -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): diff --git a/bin/effecteval b/bin/effecteval --- a/bin/effecteval +++ b/bin/effecteval @@ -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 diff --git a/bin/keyboardcomposer b/bin/keyboardcomposer --- a/bin/keyboardcomposer +++ b/bin/keyboardcomposer @@ -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 diff --git a/light9/collector/collector_client.py b/light9/collector/collector_client.py --- a/light9/collector/collector_client.py +++ b/light9/collector/collector_client.py @@ -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)) diff --git a/light9/collector/weblisteners.py b/light9/collector/weblisteners.py --- a/light9/collector/weblisteners.py +++ b/light9/collector/weblisteners.py @@ -1,6 +1,7 @@ import logging, traceback, time, json log = logging.getLogger('weblisteners') + class WebListeners(object): def __init__(self): diff --git a/light9/effect/sequencer.py b/light9/effect/sequencer.py --- a/light9/effect/sequencer.py +++ b/light9/effect/sequencer.py @@ -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 diff --git a/light9/effect/settings.py b/light9/effect/settings.py --- a/light9/effect/settings.py +++ b/light9/effect/settings.py @@ -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 diff --git a/light9/effect/simple_outputs.py b/light9/effect/simple_outputs.py --- a/light9/effect/simple_outputs.py +++ b/light9/effect/simple_outputs.py @@ -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) diff --git a/light9/vidref/musictime.py b/light9/vidref/musictime.py --- a/light9/vidref/musictime.py +++ b/light9/vidref/musictime.py @@ -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"]}, )