Changeset - 1692e8aba9f5
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 7 years ago 2018-06-09 01:59:39
drewp@bigasterisk.com
optimize KC output to collector, hopefully
Ignore-this: 6378404614fe9ac95e5d1d8819c16772
2 files changed with 8 insertions and 14 deletions:
0 comments (0 inline, 0 general)
bin/keyboardcomposer
Show inline comments
 
@@ -454,7 +454,7 @@ class KeyboardComposer(tk.Frame, SubClie
 
            for uri, box in self.subbox.items()])
 

	
 
    def get_output_settings(self, _graph=None):
 
        _graph = _graph or graph
 
        _graph = _graph or self.graph
 
        outputSettings = []
 
        for setting in _graph.objects(self.session, L9['subSetting']):
 
            effect = _graph.value(setting, L9['sub'])
 
@@ -472,7 +472,7 @@ class KeyboardComposer(tk.Frame, SubClie
 

	
 
    def save_current_stage(self, subname):
 
        log.info("saving current levels as %s", subname)
 
        with graph.currentState() as g:
 
        with self.graph.currentState() as g:
 
            ds = self.get_output_settings(_graph=g)
 
        effect = L9['effect/%s' % subname]
 
        ctx = URIRef(showconfig.showUri() + '/effect/' + subname)
 
@@ -483,17 +483,11 @@ class KeyboardComposer(tk.Frame, SubClie
 
            (effect, L9['publishAttr'], L9['strength'], ctx),
 
            ])
 

	
 
        graph.suggestPrefixes(ctx, {'eff': effect + '/'})
 
        graph.patch(Patch(addQuads=stmts, delQuads=[]))
 
        self.graph.suggestPrefixes(ctx, {'eff': effect + '/'})
 
        self.graph.patch(Patch(addQuads=stmts, delQuads=[]))
 
              
 
        self.sub_name.delete(0, tk.END)
 

	
 
    def send_frequent_updates(self):
 
        """called when we get a fade -- send events as quickly as possible"""
 
        if time.time() <= self.stop_frequent_update_time:
 
            self.send_levels()
 
            self.after(10, self.send_frequent_updates)
 

	
 
    def alltozero(self):
 
        for uri, subbox in self.subbox.items():
 
            if subbox.scale.scale_var.get() != 0:
light9/subclient.py
Show inline comments
 
@@ -14,15 +14,15 @@ class SubClient:
 
        object."""
 

	
 
    def send_levels(self):
 
        # shouldn't be handler- should be immediate mode!
 
        self.graph.addHandler(self._send_sub)
 
        self._send_sub()
 

	
 
    def send_levels_loop(self, delay=1000):
 
        task.LoopingCall(lambda: self.graph.addHandler(self.send_levels)).start(delay)
 
        task.LoopingCall(self.send_levels).start(delay)
 

	
 
    def _send_sub(self):
 
        try:
 
            outputSettings = self.get_output_settings()
 
            with self.graph.currentState() as g:
 
                outputSettings = self.get_output_settings(_graph=g)
 
        except:
 
            traceback.print_exc()
 
            return
0 comments (0 inline, 0 general)