changeset 2214:d665acb12046

cleanup
author drewp@bigasterisk.com
date Tue, 23 May 2023 13:58:26 -0700
parents 22131be6639b
children d8853f173568
files light9/fade/web/Light9FadeUi.ts light9/typedgraph.py
diffstat 2 files changed, 12 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/light9/fade/web/Light9FadeUi.ts	Tue May 23 13:13:12 2023 -0700
+++ b/light9/fade/web/Light9FadeUi.ts	Tue May 23 13:58:26 2023 -0700
@@ -109,28 +109,27 @@
     super();
     getTopGraph().then((g) => {
       this.graph = g;
-      this.graph.runHandler(this.configure.bind(this), `config ${this.uri.value}`);
-      this.graph.runHandler(this.valueSync.bind(this), `valueSync ${this.uri.value}`);
+      this.graph.runHandler(this.compile.bind(this), `config ${this.uri.value}`);
+      this.graph.runHandler(this.compileValue.bind(this), `valueSync ${this.uri.value}`);
     });
   }
 
-  configure() {
-    //   console.time(`fader configure ${this.uri.value}`)
+  private compile() {
     const U = this.graph.U();
     if (!this.graph.contains(this.uri, U("rdf:type"), U(":Fader"))) {
-      // not loaded yet
-      //   console.timeEnd(`fader configure ${this.uri.value}`)
-
+      // not loaded yet, perhaps
+      this.column = "unset";
+      this.effect = null;
+      this.effectAttr = null;
       return;
     }
     this.column = this.graph.stringValue(this.uri, U(":column"));
-    this.effect = this.graph.uriValue(this.uri, U(":effectClass"));
-    this.effectAttr = this.graph.uriValue(this.uri, U(":effectAttr"));
-    // console.timeEnd(`fader configure ${this.uri.value}`)
+    this.effect = this.graph.uriValue(this.uri, U(":effect"));
+    const s = this.graph.uriValue(this.uri, U(":setting"));
+    this.effectAttr = this.graph.uriValue(s, U(":effectAttr"));
   }
 
-  valueSync() {
-    // console.time(`valueSync ${this.uri.value}`)
+  private compileValue() {
     const U = this.graph.U();
     if (!this.graph.contains(this.uri, U("rdf:type"), U(":Fader"))) {
       // not loaded yet
@@ -139,7 +138,6 @@
     }
 
     this.value = this.graph.floatValue(this.uri, this.graph.Uri(":value"));
-    // console.timeEnd(`valueSync ${this.uri.value}`)
   }
 
   onSliderInput(ev: CustomEvent) {
@@ -149,13 +147,12 @@
     if (this.value == prev) {
       return;
     }
-    log(`new value ${this.value}`);
     meter.tick();
     this.graph.patchObject(this.uri, this.graph.Uri(":value"), this.graph.LiteralRoundedFloat(this.value), this.ctx);
   }
 
   onEffectChange(ev: CustomEvent) {
     const { newValue } = ev.detail;
-    this.graph.patchObject(this.uri, this.graph.Uri(":effectClass"), newValue, this.ctx);
+    this.graph.patchObject(this.uri, this.graph.Uri(":effect"), newValue, this.ctx);
   }
 }
--- a/light9/typedgraph.py	Tue May 23 13:13:12 2023 -0700
+++ b/light9/typedgraph.py	Tue May 23 13:58:26 2023 -0700
@@ -33,9 +33,6 @@
     ts = _expandUnion(t1)
     if len(ts) > 1:
         return any(_typeIncludes(t, t2) for t in ts)
-    # if t1 is float:
-    #     return float in get_args(t2)
-    print(f'down to {t1} {t2}')
 
     return False