Mercurial > code > home > repos > light9
annotate light8/Patch.py @ 54:3011c1028eb7
Cue math error fixed.
Cue math error fixed.
Bad cues in ConfigDummy fixed, not fixed in Config yet.
Cue fader back in rsn. Oh yeah.
author | dmcc |
---|---|
date | Mon, 08 Jul 2002 15:50:00 +0000 |
parents | 5e4fb4ac2d18 |
children | 174b35926067 |
rev | line source |
---|---|
4 | 1 from types import TupleType |
0 | 2 |
3 def get_dmx_channel(name): | |
4 if name in patch: | |
5 return patch[name] | |
6 | |
7 try: | |
8 i = int(name) | |
9 return i | |
10 except ValueError: | |
42
5e4fb4ac2d18
corrected Patch's error behavior and subediting's catching behavior
drewp
parents:
4
diff
changeset
|
11 raise ValueError("Invalid channel name: %s" % name) |
0 | 12 |
13 def get_channel_name(dmxnum): | |
14 try: | |
15 return reverse_patch[dmxnum] | |
16 except KeyError: | |
17 return str(dmxnum) | |
18 | |
4 | 19 def reload_data(dummy): |
0 | 20 global patch, reverse_patch |
4 | 21 if dummy: |
22 import ConfigDummy as Config | |
23 else: | |
24 import Config | |
0 | 25 |
4 | 26 reload(Config) |
27 loadedpatch = Config.patch | |
0 | 28 patch = {} |
29 reverse_patch = {} | |
30 for k, v in loadedpatch.items(): | |
4 | 31 if type(k) == TupleType: |
0 | 32 for name in k: |
33 patch[name] = v | |
34 reverse_patch[v] = k[0] | |
35 else: | |
36 patch[k] = v | |
37 reverse_patch[v] = k |