annotate light8/Patch.py @ 167:79bc84310e80

changes from tonight's rehearsal: changes from tonight's rehearsal: - CueFader is closer to actually running the show, computes DMX levels to send. - KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it. - Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved or loaded. to save a temporary sub, make a copy of it with a proper name since the computed name will be ugly. Also, get_normalized_copy() and crossfade() methods added. linear_fade helper (shouldn't be in Submaster, probably) added too. - dmxchanedit: longer labels - cuelist1 now has some bogus data in it and some crap removed - dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables. - patchdata: now up to date with this year's show - danshow subs song{01..19}: removed. maybe we'll re-add them in an archive directory.
author dmcc
date Tue, 08 Jul 2003 16:19:55 +0000
parents f2eb20a52555
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
85
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
1 def resolve_name(channelname):
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
2 "Ensure that we're talking about the primary name of the light."
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
3 return get_channel_name(get_dmx_channel(channelname))
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
4
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
5 def get_all_channels():
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
6 """returns primary names for all channels (sorted)"""
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
7 prinames = reverse_patch.values()[:]
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
8 prinames.sort()
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
9 return prinames
174b35926067 converts subs from dicts to tab-sep-values and back again
drewp
parents: 42
diff changeset
10
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 def get_dmx_channel(name):
45b12307c695 Initial revision
drewp
parents:
diff changeset
12 if name in patch:
45b12307c695 Initial revision
drewp
parents:
diff changeset
13 return patch[name]
45b12307c695 Initial revision
drewp
parents:
diff changeset
14
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 try:
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 i = int(name)
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 return i
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 except ValueError:
42
5e4fb4ac2d18 corrected Patch's error behavior and subediting's catching behavior
drewp
parents: 4
diff changeset
19 raise ValueError("Invalid channel name: %s" % name)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
20
45b12307c695 Initial revision
drewp
parents:
diff changeset
21 def get_channel_name(dmxnum):
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 try:
45b12307c695 Initial revision
drewp
parents:
diff changeset
23 return reverse_patch[dmxnum]
45b12307c695 Initial revision
drewp
parents:
diff changeset
24 except KeyError:
45b12307c695 Initial revision
drewp
parents:
diff changeset
25 return str(dmxnum)
45b12307c695 Initial revision
drewp
parents:
diff changeset
26
129
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
27 def reload_data():
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
28 global patch, reverse_patch
129
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
29 import patchdata
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
30
129
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
31 reload(patchdata)
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
32 loadedpatch = patchdata.patch
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
33 patch = {}
45b12307c695 Initial revision
drewp
parents:
diff changeset
34 reverse_patch = {}
45b12307c695 Initial revision
drewp
parents:
diff changeset
35 for k, v in loadedpatch.items():
129
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
36 if type(k) is tuple:
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
37 for name in k:
45b12307c695 Initial revision
drewp
parents:
diff changeset
38 patch[name] = v
45b12307c695 Initial revision
drewp
parents:
diff changeset
39 reverse_patch[v] = k[0]
45b12307c695 Initial revision
drewp
parents:
diff changeset
40 else:
45b12307c695 Initial revision
drewp
parents:
diff changeset
41 patch[k] = v
45b12307c695 Initial revision
drewp
parents:
diff changeset
42 reverse_patch[v] = k
129
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
43
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
44 # importing patch will load initial data
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
45 reload_data()
f2eb20a52555 tiny cleanups and reload on import
dmcc
parents: 85
diff changeset
46