Changeset - 167a61d3cfbf
[Not reviewed]
default
0 4 0
Drew Perttula - 12 years ago 2013-06-06 08:23:17
drewp@bigasterisk.com
subcomposer put local subs into the graph with a type edge.
Ignore-this: a0c1ef69684786e4758b9ecf10927d3b
4 files changed with 20 insertions and 10 deletions:
0 comments (0 inline, 0 general)
bin/run_local.py
Show inline comments
 
@@ -30,3 +30,4 @@ class CSH(coloredlogs.ColoredStreamHandl
 
log.addHandler(CSH(show_hostname=False, show_name=True))
 

	
 

	
 

	
bin/subcomposer
Show inline comments
 
@@ -22,16 +22,20 @@ import logging
 
import Tkinter as tk
 
import louie as dispatcher
 
from twisted.internet import reactor, tksupport, task
 
from rdflib import URIRef
 
from rdflib import URIRef, RDF
 

	
 
from run_local import log
 
log.setLevel(logging.DEBUG)
 

	
 
from light9.dmxchanedit import Levelbox
 
from light9 import dmxclient, Patch, Submaster, prof
 
from light9 import dmxclient, Submaster, prof
 
from light9.Patch import get_channel_name
 
from light9.uihelpers import toplevelat
 
from light9.rdfdb.syncedgraph import SyncedGraph
 
from light9.rdfdb import clientsession
 
from light9.tkdnd import initTkdnd
 
from light9.namespaces import L9
 
from light9.rdfdb.patch import Patch
 
from light9.observable import Observable
 
from light9.editchoice import EditChoice, Local
 

	
 
@@ -80,9 +84,10 @@ class Subcomposer(tk.Frame):
 

	
 
        EditChoice(self, self.graph, self._currentChoice).frame.pack(side='top')
 
        self.setupSubChoiceLinks()
 
        self.setupLevelboxUi()
 
        
 
    def setupSubChoiceLinks(self):
 

	
 
        graph = self.graph
 
        def ann():
 
            print "currently: session=%s currentSub=%r _currentChoice=%r" % (
 
                self.session, self.currentSub(), self._currentChoice())
 
@@ -129,10 +134,14 @@ class Subcomposer(tk.Frame):
 
        # todo: put a type on this, so subChanged can identify it right
 
        # todo: where will these get stored, or are they local to this
 
        # subcomposer process and don't use PersistentSubmaster at all?
 
        return URIRef("http://local/%s" % time.time())
 

	
 
        new = URIRef("http://local/%s" % time.time())
 
        self.graph.patch(Patch(addQuads=[(new, RDF.type, L9['Submaster'], self.session)]))
 
        
 
        return new
 
        
 
    def setupLevelboxUi(self):
 
        self.levelbox = Levelbox(self, graph, self.currentSub)
 
        self.levelbox = Levelbox(self, self.graph, self.currentSub)
 
        self.levelbox.pack(side='top')
 

	
 
        tk.Button(self, text="All to zero",
 
@@ -142,7 +151,7 @@ class Subcomposer(tk.Frame):
 
        leveldict={}
 
        for i,lev in zip(range(len(self.levels)),self.levels):
 
            if lev!=0:
 
                leveldict[Patch.get_channel_name(i+1)]=lev
 
                leveldict[get_channel_name(i+1)]=lev
 

	
 
        s=Submaster.Submaster(subname,leveldict=leveldict)
 
        s.save()
 
@@ -185,8 +194,6 @@ if __name__ == "__main__":
 
    clientsession.add_option(parser)
 
    opts, args = parser.parse_args()
 

	
 
    logging.basicConfig(level=logging.DEBUG)
 

	
 
    root=tk.Tk()
 
    root.config(bg='black')
 
    root.tk_setPalette("#004633")
light9/Submaster.py
Show inline comments
 
@@ -133,10 +133,11 @@ class PersistentSubmaster(Submaster):
 
        self.graph.addHandler(self.setName)
 
        self.graph.addHandler(self.setLevels)
 
        Submaster.__init__(self, self.name, self.levels)
 
        self.graph = graph
 
        self.uri = uri
 
        self.temporary = False
 

	
 
        # error faster if we won't be able to find where to save
 
        self.saveContext()
 

	
 
    def ident(self):
 
        return self.uri
 

	
light9/rdfdb/graphfile.py
Show inline comments
 
@@ -52,6 +52,7 @@ class GraphFile(object):
 
    def notify(self, notifier, filepath, mask):
 
        maskNames = humanReadableMask(mask)
 
        if maskNames[0] in ['open', 'access', 'close_nowrite', 'attrib', 'delete_self']:
 
            log.debug("file %s changed, ignoring %s" % (filepath, maskNames))
 
            return
 

	
 
        try:
0 comments (0 inline, 0 general)