Mercurial > code > home > repos > light9
view light8/util.py @ 176:c8d24bd2a99e
CueFaders: autoload/shifting bug fixed
CueFaders: autoload/shifting bug fixed
mute button added
cuenum attribute added
cursor is visible in CueEditron
Subcomposer: not a dummy! use DMXDUMMY=1 if you want to do dummy
cues/dolly: changes from 7.8.2003 rehearsal
author | dmcc |
---|---|
date | Thu, 10 Jul 2003 02:57:12 +0000 |
parents | 71489bb71528 |
children |
line wrap: on
line source
def maxes(dicts): ''' ({'a' : 5, 'b' : 9}, {'a' : 10, 'b' : 943}) ''' newdict = {} for d in dicts: for k,v in d.items(): newdict[k] = max(v, newdict.get(k, 0)) return newdict def scaledict(d,scl): # scales all values in dict and returns a new dict return dict([(k,v*scl) for k,v in d.items()]) # class Setting that scales, maxes def subsetdict(d, dkeys, default=0): """Subset of dictionary d: only the keys in dkeys. If you plan on omitting keys, make sure you like the default.""" newd = {} # dirty variables! for k in dkeys: newd[k] = d.get(k, default) return newd