Mercurial > code > home > repos > light9
comparison light8/sub_analyzer.py @ 85:174b35926067
converts subs from dicts to tab-sep-values and back again
author | drewp |
---|---|
date | Fri, 12 Jul 2002 12:07:38 +0000 |
parents | c74fe7efabc1 |
children | a995fd1a8f03 |
comparison
equal
deleted
inserted
replaced
84:09b3bf8a9201 | 85:174b35926067 |
---|---|
5 from Config import patch, subs | 5 from Config import patch, subs |
6 | 6 |
7 import re | 7 import re |
8 import Patch | 8 import Patch |
9 Patch.reload_data(0) | 9 Patch.reload_data(0) |
10 | |
11 def resolve_name(channelname): | |
12 "Insure that we're talking about the primary name of the light" | |
13 return Patch.get_channel_name(Patch.get_dmx_channel(channelname)) | |
14 | 10 |
15 subusage = {} | 11 subusage = {} |
16 | 12 |
17 # colors = 'ROGBVndcihs' | 13 # colors = 'ROGBVndcihs' |
18 colors = 'ndcihs' | 14 colors = 'ndcihs' |
59 '2-07' : 'finale (broadway)', | 55 '2-07' : 'finale (broadway)', |
60 } | 56 } |
61 | 57 |
62 sub_to_scene = {} | 58 sub_to_scene = {} |
63 | 59 |
64 blacklist = 'god upfill1 upfill2 upfill3 upfill4 red1 red2 red3 red4 blue1 blue2 blue3 blue4 cycleft cycright sidefill1 sidefill2'.split() | 60 # blacklist is a list of *prefixes* to light names that won't be shown |
61 blacklist = 'god upfill red blue cyc oran sidefill'.split() | |
65 blacklist.extend(['side l','side r']) | 62 blacklist.extend(['side l','side r']) |
66 | 63 |
67 for subname, levdict in subs.items(): | 64 for subname, levdict in subs.items(): |
68 if type(subname) == TupleType: | 65 if type(subname) == TupleType: |
69 subname = subname[0] | 66 subname = subname[0] |
83 | 80 |
84 def twist(l): | 81 def twist(l): |
85 return [(b,a) for a,b in l] | 82 return [(b,a) for a,b in l] |
86 | 83 |
87 def format_usage(ch, usage): | 84 def format_usage(ch, usage): |
88 if ch in blacklist: return | 85 if max([ch.startswith(pre) for pre in blacklist]): |
86 return | |
87 | |
89 usage=twist(usage) | 88 usage=twist(usage) |
90 usage.sort() | 89 usage.sort() |
91 # usage.reverse() | 90 # usage.reverse() |
92 usage=twist(usage) | 91 usage=twist(usage) |
93 print "======= %s ======= (%d uses)" % (ch, len(usage)) | 92 print "======= %s ======= (%d uses)" % (ch, len(usage)) |