Changeset - 2072a0dd7b19
[Not reviewed]
default
0 4 0
drewp@bigasterisk.com - 20 years ago 2005-04-17 02:24:29
drewp@bigasterisk.com
factor out LIGHT9_SHOW
4 files changed with 14 insertions and 17 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -11,13 +11,13 @@ import Tkinter as tk
 
from dispatch import dispatcher
 
from twisted.internet import reactor,tksupport
 
import twisted
 
from twisted.web.xmlrpc import Proxy
 

	
 
import run_local
 
from light9 import Submaster, dmxclient, networking
 
from light9 import Submaster, dmxclient, networking, showconfig
 
from light9.TLUtility import make_attributes_from_args
 
from light9.zoomcontrol import Zoomcontrol
 
from light9.curve import Curve, Curveview, Curveset, Curvesetview
 

	
 
sys.path.append("../../semprini")
 
from lengther import wavelength # for measuring duration of .wav
 
@@ -238,37 +238,33 @@ csv.pack(side='top',fill='both',exp=1)
 
ssv = SubtermSetView(root)
 
ssv.pack(side='top', fill='x')
 

	
 
song = sys.argv[1]
 
root.title("Curemaster 2000MX - %s" % song)
 

	
 
musicfilename = os.path.join(os.getenv("LIGHT9_SHOW"),'music',
 
                             "%s.wav" % song)
 
musicfilename = showconfig.songFilename(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(os.getenv("LIGHT9_SHOW"),"curves",song))
 
curveset.load(basename=os.path.join(showconfig.curvesDir(),song))
 

	
 
subterms = []
 
subterm_adder(root, curveset, subterms, root, ssv).pack(side='top',fill='x')
 
for line in file(os.path.join(os.getenv("LIGHT9_SHOW"),
 
                              "subterms",
 
                              song)):
 
for line in file(showconfig.subtermsForSong()):
 
    subname,expr = line.strip().split(" ",1)
 

	
 
    term = add_one_subterm(subname, curveset, subterms, root, ssv, expr)
 
    
 
    # stv=Subtermview(root,term)
 
    # stv.pack(side='top',fill='x')
 

	
 
out = Output(subterms)
 

	
 
def savekey(*args):
 
    print "saving",song
 
    savesubterms(os.path.join(os.getenv("LIGHT9_SHOW"),"subterms",song),
 
                 subterms)
 
    savesubterms(showconfig.subtermsForSong(song),subterms)
 
    curveset.save(basename="curves/"+song)
 
    print "saved"
 

	
 
    
 
root.bind("<Control-Key-s>",savekey)
 

	
light9/Patch.py
Show inline comments
 
@@ -27,13 +27,13 @@ def get_channel_name(dmxnum):
 
        return str(dmxnum)
 

	
 
def reload_data():
 
    global patch, reverse_patch
 

	
 
    loc = {}
 
    execfile(os.path.join(os.getenv("LIGHT9_SHOW"),"patchdata.py"), loc)
 
    execfile(showconfig.patchData(), loc)
 
    
 
    loadedpatch = loc['patch']
 
    patch = {}
 
    reverse_patch = {}
 
    for k, v in loadedpatch.items():
 
        if type(k) is tuple:
light9/Submaster.py
Show inline comments
 
from __future__ import division
 
import os
 
from light9.TLUtility import dict_scale, dict_max
 
from light9 import Patch
 
from light9 import Patch, showconfig
 

	
 
class Submaster:
 
    "Contain a dictionary of levels, but you didn't need to know that"
 
    def __init__(self, name, leveldict=None, temporary=0):
 
        self.name = name
 
        self.temporary = temporary
 
@@ -15,14 +15,13 @@ class Submaster:
 
            self.reload()
 
    def reload(self):
 
        if self.temporary:
 
            return
 
        try:
 
            self.levels.clear()
 
            subfile = file(os.path.join(os.getenv("LIGHT9_SHOW"),
 
                                        "subs",self.name))
 
            subfile = file(showconfig.subFile(self.name))
 
            for line in subfile.readlines():
 
                if not line.strip(): # if line is only whitespace
 
                    continue # "did i say newspace?"
 

	
 
                try:
 
                    name, val = line.split(':')
 
@@ -35,14 +34,13 @@ class Submaster:
 
            print "Can't read file for sub: %s" % self.name
 
    def save(self):
 
        if self.temporary:
 
            print "not saving temporary sub named",self.name
 
            return
 

	
 
        subfile = file(os.path.join(os.getenv("LIGHT9_SHOW"),
 
                                    "subs",self.name), 'w')
 
        subfile = file(showconfig.subFile(self.name), 'w')
 
        names = self.levels.keys()
 
        names.sort()
 
        for name in names:
 
            val = self.levels[name]
 
            subfile.write("%s : %s\n" % (name, val))
 
    def set_level(self, channelname, level, save=1):
 
@@ -128,13 +126,13 @@ def sub_maxes(*subs):
 

	
 
class Submasters:
 
    "Collection o' Submaster objects"
 
    def __init__(self):
 
        self.submasters = {}
 

	
 
        files = os.listdir(os.path.join(os.getenv("LIGHT9_SHOW"),'subs'))
 
        files = os.listdir(showconfig.subsDir())
 

	
 
        for filename in files:
 
            # we don't want these files
 
            if filename.startswith('.') or filename.endswith('~') or \
 
               filename.startswith('CVS'):
 
                continue
light9/networking.py
Show inline comments
 
@@ -7,7 +7,10 @@ def dmxServerUrl():
 
    return "http://localhost:%s" % dmxServerPort()
 

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

	
 
def musicPort():
 
    return 8040
0 comments (0 inline, 0 general)