Changeset - 8a1ec8aca432
[Not reviewed]
default
0 5 0
drewp@bigasterisk.com - 18 years ago 2007-06-10 03:27:16
drewp@bigasterisk.com
more rdf updates
5 files changed with 26 insertions and 22 deletions:
0 comments (0 inline, 0 general)
bin/ascoltami
Show inline comments
 
@@ -492,13 +492,13 @@ def main():
 
    tk.Label(goRow, text="Go button action",
 
             font='arial 9', **appstyle).pack(side='left', fill='both')
 
    goStatus = tk.Label(goRow, font='arial 12 bold', **appstyle)
 
    goStatus.config(bg='#800000', fg='white', relief='ridge')
 
    goStatus.pack(side='left', expand=True, fill='x')
 

	
 
    go = GoButton(player, goStatus, songfiles)
 
    go = GoButton(player, goStatus, songs)
 
    
 
    buts = ControlButtons(root, go, player, root)
 

	
 
    songlist.pack(fill='both', expand=True)
 
    buts.pack(side='top', fill='x')
 
    seeker.pack(side='top', fill='x')
bin/curvecalc
Show inline comments
 
@@ -12,24 +12,26 @@ try:
 
    from dispatch import dispatcher
 
except ImportError:
 
    import louie as dispatcher 
 
from twisted.internet import reactor,tksupport
 
import twisted
 
from twisted.web.xmlrpc import Proxy
 
from rdflib import Literal, URIRef
 
import logging
 
log = logging.getLogger()
 
logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s")
 
log.setLevel(logging.DEBUG)
 

	
 
import run_local
 
from light9 import Submaster, dmxclient, networking, showconfig
 
from light9.TLUtility import make_attributes_from_args, dict_subset
 
from light9.zoomcontrol import Zoomcontrol
 
from light9.curve import Curve, Curveview, Curveset, Curvesetview
 
from light9.wavelength import wavelength
 
from light9.uihelpers import toplevelat
 
from light9.namespaces import L9
 

	
 
import light9.Effects
 
fx_dict = light9.Effects.__dict__
 
all_fx = fx_dict['__all__']
 
expr_helpers = dict_subset(fx_dict, all_fx)
 
del fx_dict
 
@@ -269,17 +271,18 @@ class SubtermSetView(tk.Frame):
 

	
 
        self.cur_col += 1
 
        self.cur_col %= self.ncols
 
        if self.cur_col == 0:
 
            self.cur_row += 1
 

	
 
def add_one_subterm(subname, curveset, subterms, root, ssv, expr=None):
 
def add_one_subterm(graph, sub, curveset, subterms, root, ssv, expr=None):
 
    subname = graph.label(sub)
 
    if expr is None:
 
        expr = '%s(t)' % subname
 

	
 
    term = Subterm(Submaster.Submaster(subname), Subexpr(curveset,expr))
 
    term = Subterm(Submaster.Submaster(sub), Subexpr(curveset,expr))
 
    subterms.append(term)
 

	
 
    stv=Subtermview(ssv,term)
 
    # stv.pack(side='top',fill='x')
 

	
 
    ssv.add_subtermview(stv)
 
@@ -303,36 +306,28 @@ def sub_commands_tk(master, curveset, su
 
    entry = tk.Entry(f, textvariable=newname)
 
    entry.pack(side='left', fill='x', exp=1)
 
    entry.bind("<Key-Return>", lambda evt: add_cmd())
 

	
 
    return f
 

	
 
def add_subterms_from_file(filename, curveset, subterms, root, ssv):
 
    for line in file(filename):
 
        try:
 
            subname,expr = line.strip().split(" ",1)
 
        except ValueError:
 
            subname = line.strip()
 
            expr = ""
 

	
 
        term = add_one_subterm(subname, curveset, subterms, root, ssv, expr)
 

	
 
        # stv=Subtermview(root,term)
 
        # stv.pack(side='top',fill='x')
 
def add_subterms_for_song(graph, song, curveset, subterms, root, ssv):
 
    for st in graph.objects(song, L9['subterm']):
 
        add_one_subterm(graph, graph.value(st, L9['sub']), curveset, subterms,
 
                        root, ssv, graph.value(st, L9['expression']))
 

	
 
#######################################################################
 
root=tk.Tk()
 
root.tk_setPalette("gray50")
 
toplevelat("curvecalc",root)
 
root.tk_focusFollowsMouse()
 

	
 
parser = optparse.OptionParser()
 
options,args = parser.parse_args()
 

	
 
try:
 
    song = args[0]
 
    song = URIRef(args[0])
 
except IndexError:
 
    raise SystemExit("song name is required, e.g. '05-mix'")
 

	
 
log.debug("music")
 
music=Music()
 

	
 
@@ -343,25 +338,25 @@ curveset = Curveset()
 
csv = Curvesetview(root,curveset)
 
csv.pack(side='top',fill='both',exp=1)
 

	
 
ssv = SubtermSetView(root)
 
ssv.pack(side='top', fill='x')
 

	
 
root.title("Curvemaster 3000MX - %s" % song)
 
graph = showconfig.getGraph()
 
root.title("Curvemaster 3000MX - %s" % graph.label(song))
 

	
 
musicfilename = showconfig.songFilename(song)
 
musicfilename = showconfig.songOnDisk(song)
 
maxtime = wavelength(musicfilename)
 
dispatcher.send("max time",maxtime=maxtime)
 
dispatcher.connect(lambda: maxtime, "get max time",weak=0)
 
curveset.load(basename=os.path.join(showconfig.curvesDir(),song))
 

	
 
subterms = []
 
sub_commands_tk(root, curveset, subterms, root, ssv).pack(side='top',fill='x')
 

	
 
add_subterms_from_file(showconfig.subtermsForSong(song),
 
                       curveset, subterms, root, ssv)
 
add_subterms_for_song(graph, song, curveset, subterms, root, ssv)
 

	
 
log.debug("output")
 
out = Output(subterms, music)
 

	
 
def savekey(*args):
 
    print "saving",song
light9/Submaster.py
Show inline comments
 
@@ -9,23 +9,30 @@ try:
 
    import dispatch.dispatcher as dispatcher
 
except ImportError:
 
    from louie import dispatcher
 

	
 
class Submaster:
 
    "Contain a dictionary of levels, but you didn't need to know that"
 
    def __init__(self, name, leveldict=None, temporary=0):
 
    def __init__(self,
 
                 name=None,
 
                 graph=None, sub=None,
 
                 leveldict=None, temporary=0):
 
        if sub is not None:
 
            name = graph.label(sub)
 
        self.name = name
 
        self.temporary = temporary
 
        if leveldict:
 
            self.levels = leveldict
 
        else:
 
            self.levels = {}
 
            self.reload(quiet=True)
 
        if not self.temporary:
 
            dispatcher.connect(self.reload, 'reload all subs')
 
    def reload(self, quiet=False):
 
        print "no submaster reload"
 
        return
 
        if self.temporary:
 
            return
 
        try:
 
            oldlevels = self.levels.copy()
 
            self.levels.clear()
 
            patchGraph = showconfig.getGraph()
light9/io/__init__.py
Show inline comments
 
@@ -55,12 +55,14 @@ class ParportDMX(BaseIO):
 
            self.parport.outbyte(levels[p-1]*255 / 100)
 

	
 
class UsbDMX(BaseIO):
 
    dimmers = 512
 
    def __init__(self):
 
        BaseIO.__init__(self)
 
        if self.dummy:
 
            return
 
        sys.path.append("/home/drewp/dmx_usb_module")
 
        from dmx import Dmx
 
        self.out = Dmx()
 

	
 
    def sendlevels(self, levels):
 
        if self.dummy:
light9/networking.py
Show inline comments
 
@@ -9,13 +9,13 @@ def dmxServerUrl():
 
    return "http://localhost:%s" % dmxServerPort()
 

	
 
def dmxServerPort():
 
    return 8030
 
    
 
def musicUrl():
 
    return "http://score:%s" % musicPort()
 
    return "http://localhost:%s" % musicPort()
 

	
 
def musicPort():
 
    return 8040
 

	
 
def mpdServer():
 
    """servername, port"""
0 comments (0 inline, 0 general)