Changeset - e04f7b552bcd
[Not reviewed]
default
0 9 0
dmcc - 22 years ago 2002-07-14 08:01:24

- scroll wheel works everywhere
- scroll wheel works everywhere
- interface is white on black
- subs that start scenes are white
- more status information, startup process kinda cleaned up
9 files changed with 127 insertions and 84 deletions:
0 comments (0 inline, 0 general)
light8/Config.py
Show inline comments
 
@@ -68,135 +68,135 @@ patch = {
 
    'cafe2': 16,
 
    'dream':17,
 
    'xmas':41,
 
}
 

	
 
from util import maxes,scaledict
 
FL=100
 
def fulls(chans):
 
    # pass a list or multiple args
 
    return dict([(c,FL) for c in chans])
 
def levs(chans,levs):
 
    return dict([(c,v) for c,v in zip(chans,levs)])
 
subs={}
 

	
 
subs[('col blue', 'blue')]={ 'blue1': 100, 'blue2': 100, 'blue3': 100, 'blue4': 100, }
 

	
 
subs[('col gree', 'green')]={ 'gree1': 100, 'gree2': 100, 'gree3': 100, 'gree4': 100, }
 

	
 
subs[('col oran', '#EEEE99')]={ 'oran1': 100, 'oran2': 100, 'oran3': 100, 'oran4': 100, }
 

	
 
subs[('col red', 'red')]={ 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, }
 

	
 
subs[('house', 'black')]={ 'house': 100, }
 

	
 
subs['*1-01-0']={ 'b22': 100, 'b24': 100, 'b25': 100, 'b34': 100, 'cycleft': 41, 'cycright': 41, 'desk2': 78, 'edge': 80, 'hotbox1': 43, 'hotbox2': 91, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 3': 100, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 100, 'marry2': 100, 'side l': 100, 'side r': 100, 'sidefill1': 100, 'sidefill2': 100, 'upfill1': 56, 'upfill2': 91, 'upfill3': 60, 'upfill4': 68, }
 
subs[('*1-01-0', 'white')]={ 'b22': 100, 'b24': 100, 'b25': 100, 'b34': 100, 'cycleft': 41, 'cycright': 41, 'desk2': 78, 'edge': 80, 'hotbox1': 43, 'hotbox2': 91, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 3': 100, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 100, 'marry2': 100, 'side l': 100, 'side r': 100, 'sidefill1': 100, 'sidefill2': 100, 'upfill1': 56, 'upfill2': 91, 'upfill3': 60, 'upfill4': 68, }
 

	
 
subs['*1-01-9 end conversations']={ 'b22': 63, 'b23': 12, 'b24': 42, 'b25': 63, 'b34': 63, 'cuba1': 63, 'cuba2': 42, 'cycleft': 25, 'cycright': 25, 'desk2': 12, 'edge': 13, 'hotbox1': 37, 'hotbox2': 63, 'main 10': 63, 'main 11': 63, 'main 2': 63, 'main 3': 26, 'main 4': 63, 'main 5': 100, 'main 7': 63, 'main 8': 63, 'main 9': 63, 'marry1': 100, 'marry2': 63, 'side l': 63, 'side r': 63, 'sidefill1': 26, 'sidefill2': 63, 'upfill1': 29, 'upfill2': 63, 'upfill3': 43, 'upfill4': 29, }
 

	
 
subs['*1-02-0']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b32': 14, 'cuba2': 38, 'cycright': 63, 'desk1': 53, 'desk2': 65, 'hotbox1': 25, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 4': 100, 'main 5': 70, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 61, 'marry2': 47, 'rock': 23, 'sidefill2': 51, 'upfill2': 6, 'upfill3': 55, }
 
subs[('*1-02-0', 'white')]={ 'b22': 100, 'b23': 100, 'b24': 100, 'b32': 14, 'cuba2': 38, 'cycright': 63, 'desk1': 53, 'desk2': 65, 'hotbox1': 25, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 4': 100, 'main 5': 70, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 61, 'marry2': 47, 'rock': 23, 'sidefill2': 51, 'upfill2': 6, 'upfill3': 55, }
 

	
 
subs['*1-02-1 desk solo']={ 'b22': 100, 'b23': 100, 'b24': 22, 'cycright': 37, 'desk1': 53, 'desk2': 89, 'hotbox1': 25, 'hotbox2': 7, 'main 10': 22, 'main 11': 22, 'main 3': 9, 'main 4': 22, 'main 7': 100, 'main 8': 22, 'main 9': 22, 'marry1': 61, 'marry2': 22, 'rock': 14, }
 

	
 
subs['*1-03-0']={ 'phone': 100, 'upfill2':50, 'upfill3':50, }
 
subs[('*1-03-0', 'white')]={ 'phone': 100, 'upfill2':50, 'upfill3':50, }
 

	
 
subs['*1-04-00-dance']={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 
subs[('*1-04-00-dance', 'white')]={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 

	
 
subs['*1-04-01 dark tables']={ 'b23': 67, 'b24': 67, 'b32': 2, 'b34': 12, 'blue1': 33, 'blue2': 33, 'blue3': 33, 'blue4': 33, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'edge': 9, 'hotback': 100, 'hotbox1': 46, 'hotbox2': 45, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 13, 'main 4': 100, 'main 7': 100, 'main 8': 29, 'main 9': 100, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill4': 26, }
 

	
 
subs['*1-04-02 solo ada']={ 'b23': 62, 'b24': 100, 'b32': 2, 'b34': 12, 'blue1': 33, 'blue2': 33, 'blue3': 33, 'blue4': 33, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 32, 'hotbox2': 24, 'main 10': 11, 'main 11': 2, 'main 2': 13, 'main 4': 100, 'main 7': 100, 'main 9': 61, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill4': 26, }
 

	
 
subs['*1-04-10-after dance']={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 

	
 
subs['*1-04-20-table']={ 'b22': 100, 'cuba1': 22, 'desk2': 58, 'hotbox2': 46, 'main 2': 62, 'main 3': 80, 'main 4': 100, 'main 5': 34, 'main 7': 10, 'main 8': 10, 'main 9': 64, 'red1': 100, 'rock': 22, }
 

	
 
subs['*1-04-30-small table']={ 'b22': 100, 'desk1': 50, 'desk2': 34, 'red1': 100, 'upfill1': 62, 'upfill4': 62, }
 

	
 
subs['*1-05-0']={ 'b13': 100, 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, 'b34': 13, 'cycleft': 18, 'cycright': 36, 'desk1': 19, 'desk2': 31, 'edge': 37, 'hotbox2': 17, 'main 10': 100, 'main 11': 89, 'main 2': 100, 'main 3': 85, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'side l': 100, 'side r': 82, 'sidefill1': 100, 'sidefill2': 100, 'upfill2': 37, 'upfill3': 37, }
 
subs[('*1-05-0', 'white')]={ 'b13': 100, 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, 'b34': 13, 'cycleft': 18, 'cycright': 36, 'desk1': 19, 'desk2': 31, 'edge': 37, 'hotbox2': 17, 'main 10': 100, 'main 11': 89, 'main 2': 100, 'main 3': 85, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'side l': 100, 'side r': 82, 'sidefill1': 100, 'sidefill2': 100, 'upfill2': 37, 'upfill3': 37, }
 

	
 
subs['*1-06-0']={ 'b22': 49, 'b23': 100, 'b24': 100, 'b25': 100, 'b32': 80, 'b34': 100, 'cycright': 53, 'desk2': 78, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry2': 100, 'rock': 60, 'side l': 100, 'side r': 100, 'sidefill1': 59, 'sidefill2': 100, }
 
subs[('*1-06-0', 'white')]={ 'b22': 49, 'b23': 100, 'b24': 100, 'b25': 100, 'b32': 80, 'b34': 100, 'cycright': 53, 'desk2': 78, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry2': 100, 'rock': 60, 'side l': 100, 'side r': 100, 'sidefill1': 59, 'sidefill2': 100, }
 

	
 
subs['*1-07-0']={ 'b22': 82, 'b23': 100, 'b24': 100, 'b25': 64, 'b34': 28, 'blue1': 93, 'blue2': 93, 'blue3': 93, 'blue4': 93, 'edge': 12, 'hotbox2': 11, 'main 10': 37, 'main 11': 37, 'main 2': 37, 'main 3': 25, 'main 4': 37, 'main 5': 37, 'main 7': 37, 'main 8': 37, 'main 9': 37, 'marry1': 37, 'side l': 49, 'side r': 36, 'sidefill1': 37, 'sidefill2': 37, 'upfill2': 18, 'upfill3': 6, }
 
subs[('*1-07-0', 'white')]={ 'b22': 82, 'b23': 100, 'b24': 100, 'b25': 64, 'b34': 28, 'blue1': 93, 'blue2': 93, 'blue3': 93, 'blue4': 93, 'edge': 12, 'hotbox2': 11, 'main 10': 37, 'main 11': 37, 'main 2': 37, 'main 3': 25, 'main 4': 37, 'main 5': 37, 'main 7': 37, 'main 8': 37, 'main 9': 37, 'marry1': 37, 'side l': 49, 'side r': 36, 'sidefill1': 37, 'sidefill2': 37, 'upfill2': 18, 'upfill3': 6, }
 

	
 
subs['*1-08-00-left cafe']={ 'b22': 40, 'cafe1': 71, 'edge': 41, }
 
subs[('*1-08-00-left cafe', 'white')]={ 'b22': 40, 'cafe1': 71, 'edge': 41, }
 

	
 
subs['*1-08-10-right cafe']={ 'b32': 10, 'b34': 31, 'cafe2': 100, 'cuba1': 53, 'cuba2': 76, }
 

	
 
subs['*1-08-10-centerwalk']={ 'b23': 100, 'b24': 100, }
 

	
 
subs['*1-08-10-rightwalk']={ 'b25': 100, }
 

	
 
subs['*1-08-20-backdrop']={ 'upfill1': 100, 'upfill2': 100, 'upfill3': 100, 'upfill4': 100, }
 

	
 
subs['*1-08-30-full']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, 'b32': 23, 'b34': 24, 'blue1': 15, 'blue2': 15, 'blue3': 15, 'blue4': 15, 'cafe1': 100, 'cafe2': 50, 'cycleft': 15, 'cycright': 15, 'desk2': 30, 'edge': 31, 'gree1': 15, 'gree2': 15, 'gree3': 15, 'gree4': 15, 'hotbox1': 38, 'hotbox2': 38, 'main 10': 38, 'main 11': 38, 'main 2': 38, 'main 3': 38, 'main 4': 38, 'main 5': 38, 'main 7': 38, 'main 8': 38, 'main 9': 38, 'marry1': 38, 'marry2': 38, 'oran1': 82, 'oran2': 82, 'oran3': 82, 'oran4': 82, 'phone': 31, 'red1': 77, 'red2': 77, 'red3': 77, 'red4': 95, 'side l': 38, 'side r': 38, 'sidefill1': 38, 'sidefill2': 38, 'upfill1': 100, 'upfill2': 100, 'upfill3': 100, 'upfill4': 100, }
 

	
 
subs['*1-09-0']={ 'b22': 32, 'b23': 21, 'b24': 21, 'b25': 62, 'b34': 9, 'blue1': 92, 'blue2': 92, 'blue3': 92, 'blue4': 92, 'cafe1': 37, 'cafe2': 37, 'desk2': 16, 'gree1': 53, 'gree2': 53, 'gree3': 53, 'gree4': 53, 'main 10': 43, 'main 11': 37, 'main 2': 61, 'main 5': 64, 'main 8': 47, 'main 9': 38, 'marry2': 9, 'oran1': 31, 'oran2': 31, 'oran3': 31, 'oran4': 31, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 30, 'upfill2': 43, 'upfill3': 43, 'upfill4': 30, }
 
subs[('*1-09-0', 'white')]={ 'b22': 32, 'b23': 21, 'b24': 21, 'b25': 62, 'b34': 9, 'blue1': 92, 'blue2': 92, 'blue3': 92, 'blue4': 92, 'cafe1': 37, 'cafe2': 37, 'desk2': 16, 'gree1': 53, 'gree2': 53, 'gree3': 53, 'gree4': 53, 'main 10': 43, 'main 11': 37, 'main 2': 61, 'main 5': 64, 'main 8': 47, 'main 9': 38, 'marry2': 9, 'oran1': 31, 'oran2': 31, 'oran3': 31, 'oran4': 31, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 30, 'upfill2': 43, 'upfill3': 43, 'upfill4': 30, }
 

	
 
subs['*1-10-0']={ 'b13': 15, 'b22': 44, 'b23': 20, 'b24': 34, 'b25': 34, 'b32': 27, 'b34': 34, 'blue1': 84, 'blue2': 54, 'cuba1': 5, 'desk1': 17, 'desk2': 11, 'hotbox2': 34, 'main 10': 34, 'main 11': 34, 'main 2': 34, 'main 3': 25, 'main 4': 25, 'main 5': 34, 'main 7': 34, 'main 8': 34, 'main 9': 34, 'rock': 3, 'side l': 23, 'side r': 14, 'sidefill1': 6, 'sidefill2': 23, }
 
subs[('*1-10-0', 'white')]={ 'b13': 15, 'b22': 44, 'b23': 20, 'b24': 34, 'b25': 34, 'b32': 27, 'b34': 34, 'blue1': 84, 'blue2': 54, 'cuba1': 5, 'desk1': 17, 'desk2': 11, 'hotbox2': 34, 'main 10': 34, 'main 11': 34, 'main 2': 34, 'main 3': 25, 'main 4': 25, 'main 5': 34, 'main 7': 34, 'main 8': 34, 'main 9': 34, 'rock': 3, 'side l': 23, 'side r': 14, 'sidefill1': 6, 'sidefill2': 23, }
 

	
 
subs['*2-01-0-dance']={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 
subs[('*2-01-0-dance', 'white')]={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 

	
 
subs['*2-01-01-solo']={ 'b23': 100, 'b24': 100, 'b32': 43, 'cycleft': 55, 'cycright': 55, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 7': 100, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 67, 'upfill2': 1, 'upfill4': 67, }
 

	
 
subs['*2-01-1-after dance']={ 'b32': 43, 'b34': 30, 'cycleft': 19, 'cycright': 19, 'desk2': 24, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 78, 'main 10': 100, 'main 11': 46, 'main 2': 46, 'main 3': 46, 'main 4': 46, 'main 5': 100, 'main 7': 100, 'main 8': 46, 'main 9': 46, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill1': 26, 'upfill2': 46, 'upfill3': 32, 'upfill4': 26, }
 

	
 
subs['*2-01-1-darker dance']={ 'b23': 93, 'b24': 93, 'b32': 4, 'b34': 9, 'cycleft': 19, 'cycright': 19, 'desk2': 10, 'hotback': 100, 'hotbox1': 42, 'hotbox2': 52, 'red1': 100, 'red2': 100, 'red3': 100, 'red4': 100, 'upfill4': 26, }
 

	
 
subs['*2-01-2-table']={ 'b22': 100, 'cuba1': 22, 'desk2': 58, 'hotbox2': 46, 'main 2': 62, 'main 3': 80, 'main 4': 100, 'main 5': 34, 'main 7': 10, 'main 8': 10, 'main 9': 64, 'red1': 100, 'rock': 22, 'upfill1': 76, 'upfill2': 76, 'upfill3': 76, 'upfill4': 76, }
 

	
 
subs['*2-01-3-small table']={ 'b22': 56, 'b25': 5, 'desk1': 47, 'desk2': 58, 'main 3': 18, 'main 9': 11, 'red1': 100, 'upfill1': 62, 'upfill4': 62, }
 

	
 
subs['*2-02-0']={ 'b23': 76, 'b24': 52, 'main 10': 53, 'main 2': 53, 'main 4': 24, 'main 5': 18, 'main 7': 42, 'main 8': 36, 'main 9': 60, 'marry2': 38, 'side r': 34, }
 
subs[('*2-02-0', 'white')]={ 'b23': 76, 'b24': 52, 'main 10': 53, 'main 2': 53, 'main 4': 24, 'main 5': 18, 'main 7': 42, 'main 8': 36, 'main 9': 60, 'marry2': 38, 'side r': 34, }
 

	
 
subs['*2-02-1-works']={'upfill2':50,'upfill3':50,'cycright':50}
 

	
 
subs['*2-03-00-open dance']={ 'b22': 11, 'blue1': 70, 'blue2': 70, 'blue3': 70, 'blue4': 92, 'cuba1': 20, 'gree1': 75, 'gree2': 75, 'gree3': 75, 'gree4': 75, 'hotback': 40, 'main 10': 40, 'main 11': 28, 'main 2': 60, 'main 4': 45, 'main 5': 20, 'main 8': 26, 'main 9': 42, 'red1': 75, 'red2': 75, 'red3': 75, 'red4': 97, 'side l': 31, 'side r': 31, 'upfill1': 27, 'upfill2': 31, 'upfill3': 26, 'upfill4': 17, }
 
subs[('*2-03-00-open dance', 'white')]={ 'b22': 11, 'blue1': 70, 'blue2': 70, 'blue3': 70, 'blue4': 92, 'cuba1': 20, 'gree1': 75, 'gree2': 75, 'gree3': 75, 'gree4': 75, 'hotback': 40, 'main 10': 40, 'main 11': 28, 'main 2': 60, 'main 4': 45, 'main 5': 20, 'main 8': 26, 'main 9': 42, 'red1': 75, 'red2': 75, 'red3': 75, 'red4': 97, 'side l': 31, 'side r': 31, 'upfill1': 27, 'upfill2': 31, 'upfill3': 26, 'upfill4': 17, }
 

	
 
subs['*2-03-10-dialogue']={ 'b13': 60, 'b22': 62, 'b23': 64, 'b24': 19, 'b25': 16, 'blue1': 70, 'blue2': 70, 'blue3': 70, 'blue4': 92, 'cuba1': 59, 'gree1': 75, 'gree2': 75, 'gree3': 75, 'gree4': 75, 'hotback': 40, 'main 10': 48, 'main 11': 40, 'main 2': 54, 'main 4': 45, 'main 5': 20, 'main 8': 22, 'main 9': 73, 'red1': 75, 'red2': 75, 'red3': 75, 'red4': 97, 'side l': 31, 'side r': 31, 'sidefill1': 20, 'sidefill2': 20, 'upfill1': 27, 'upfill2': 31, 'upfill3': 26, 'upfill4': 17, }
 

	
 
subs['*2-03-20-luckcover']={ 'b22': 20, 'b23': 20, 'b24': 20, 'b25': 20, 'blue1': 70, 'blue2': 70, 'blue3': 70, 'blue4': 92, 'cuba1': 5, 'gree1': 75, 'gree2': 75, 'gree3': 75, 'gree4': 75, 'hotback': 40, 'main 7': 100, 'main 8': 57, 'red1': 75, 'red2': 75, 'red3': 75, 'red4': 97, 'side l': 31, 'side r': 31, 'upfill1': 27, 'upfill2': 31, 'upfill3': 26, 'upfill4': 17, }
 

	
 
subs['*2-03-20-luck-l']={ 'b22': 100, }
 

	
 
subs['*2-03-20-luck-c']={ 'b23': 100, 'b24': 100, }
 

	
 
subs['*2-03-20-luck-r']={ 'b25': 100, }
 

	
 
subs['*2-04-0']={ 'b13': 39, 'b22': 50, 'b23': 67, 'b24': 67, 'b25': 71, 'b32': 57, 'b34': 34, 'blue1': 63, 'blue2': 63, 'blue3': 63, 'blue4': 63, 'cycright': 18, 'desk1': 24, 'desk2': 26, 'hotbox2': 59, 'main 10': 5, 'main 11': 5, 'main 2': 5, 'main 3': 45, 'main 5': 56, 'main 7': 5, 'main 8': 5, 'main 9': 5, 'marry2': 50, 'rock': 20, 'side r': 34, 'upfill1': 70, 'upfill4': 70, }
 
subs[('*2-04-0', 'white')]={ 'b13': 39, 'b22': 50, 'b23': 67, 'b24': 67, 'b25': 71, 'b32': 57, 'b34': 34, 'blue1': 63, 'blue2': 63, 'blue3': 63, 'blue4': 63, 'cycright': 18, 'desk1': 24, 'desk2': 26, 'hotbox2': 59, 'main 10': 5, 'main 11': 5, 'main 2': 5, 'main 3': 45, 'main 5': 56, 'main 7': 5, 'main 8': 5, 'main 9': 5, 'marry2': 50, 'rock': 20, 'side r': 34, 'upfill1': 70, 'upfill4': 70, }
 

	
 
subs['*2-05-0']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b32': 14, 'cuba2': 9, 'desk1': 53, 'desk2': 65, 'hotbox1': 25, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 4': 100, 'main 5': 70, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 61, 'marry2': 47, 'rock': 23, 'sidefill2': 25, 'upfill2': 6, 'upfill3': 34, }
 
subs[('*2-05-0', 'white')]={ 'b22': 100, 'b23': 100, 'b24': 100, 'b32': 14, 'cuba2': 9, 'desk1': 53, 'desk2': 65, 'hotbox1': 25, 'hotbox2': 100, 'main 10': 100, 'main 11': 100, 'main 4': 100, 'main 5': 70, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 61, 'marry2': 47, 'rock': 23, 'sidefill2': 25, 'upfill2': 6, 'upfill3': 34, }
 

	
 
subs['*2-05-1-dream']={ 'desk2': 42, 'dream': 100, 'main 11': 7, 'upfill2': 16, }
 

	
 
subs['*2-05-2-boat']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b32': 52, 'cuba2': 65, 'cycright': 55, 'desk1': 44, 'desk2': 84, 'hotbox1': 21, 'hotbox2': 95, 'main 10': 84, 'main 11': 84, 'main 3': 72, 'main 4': 100, 'main 5': 83, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 75, 'marry2': 100, 'rock': 43, 'sidefill2': 43, 'upfill2': 55, 'upfill3': 31, }
 

	
 
subs['*2-06-0']={ 'b22': 14, 'b23': 100, 'b24': 100, 'b32': 23, 'b34': 30, 'cycright': 100, 'desk2': 23, 'hotbox1': 49, 'hotbox2': 43, 'main 10': 55, 'main 11': 55, 'main 2': 30, 'main 7': 30, 'main 9': 30, 'marry1': 69, 'marry2': 34, 'rock': 17, 'side r': 30, 'upfill1': 48, 'upfill4': 48, }
 
subs[('*2-06-0', 'white')]={ 'b22': 14, 'b23': 100, 'b24': 100, 'b32': 23, 'b34': 30, 'cycright': 100, 'desk2': 23, 'hotbox1': 49, 'hotbox2': 43, 'main 10': 55, 'main 11': 55, 'main 2': 30, 'main 7': 30, 'main 9': 30, 'marry1': 69, 'marry2': 34, 'rock': 17, 'side r': 30, 'upfill1': 48, 'upfill4': 48, }
 

	
 
subs['*2-06-1-patio right']={ 'patio2': 100, }
 

	
 
subs['*2-06-2 patio left']={ 'patio1': 100, }
 

	
 
subs['*2-07-0']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, 'b34': 100, 'cycleft': 41, 'cycright': 41, 'desk2': 78, 'edge': 63, 'hotbox1': 14, 'hotbox2': 5, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 3': 83, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 100, 'marry2': 100, 'phone': 62, 'side l': 100, 'side r': 100, 'sidefill1': 83, 'sidefill2': 100, 'upfill1': 56, 'upfill2': 100, 'upfill3': 69, 'upfill4': 56, }
 
subs[('*2-07-0', 'white')]={ 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, 'b34': 100, 'cycleft': 41, 'cycright': 41, 'desk2': 78, 'edge': 63, 'hotbox1': 14, 'hotbox2': 5, 'main 10': 100, 'main 11': 100, 'main 2': 100, 'main 3': 83, 'main 4': 100, 'main 5': 100, 'main 7': 100, 'main 8': 100, 'main 9': 100, 'marry1': 100, 'marry2': 100, 'phone': 62, 'side l': 100, 'side r': 100, 'sidefill1': 83, 'sidefill2': 100, 'upfill1': 56, 'upfill2': 100, 'upfill3': 69, 'upfill4': 56, }
 

	
 
subs['*curtain']={ 'b22': 73, 'b24': 73, 'b25': 73, 'b34': 73, 'desk2': 57, 'edge': 58, 'hotbox2': 73, 'main 10': 73, 'main 11': 73, 'main 2': 73, 'main 3': 73, 'main 4': 73, 'main 5': 73, 'main 7': 73, 'main 8': 73, 'main 9': 73, 'marry1': 73, 'marry2': 73, 'phone': 58, 'side l': 73, 'side r': 73, 'sidefill1': 23, 'sidefill2': 23, 'upfill1': 9, 'upfill2': 68, 'upfill3': 18, 'upfill4': 9, }
 

	
 
subs['*phone booth']={ 'phone': 100, }
 

	
 
subs['*spare']={ }
 

	
 
subs['bank1ctr']={ 'b22': 100, 'b23': 100, 'b24': 100, 'b25': 100, }
 

	
 
subs['cyc']={ 'cycleft': 100, 'cycright': 100, }
 

	
 
subs['god']={ 'god': 100, }
 

	
 
subs['patio left']={ 'patio1': 100, }
 

	
 
subs['patio right']={ 'patio2': 100, }
 

	
 
subs['sidefill']={ 'sidefill1': 100, 'sidefill2': 100, }
 

	
 
subs['sidepost']={ 'side l': 100, 'side r': 100, }
 

	
 
subs['upfill sides']={ 'upfill1': 100, 'upfill4': 100, }
 

	
 
subs["*interscene"] = {}
light8/ExtSliderMapper.py
Show inline comments
 
""" The External Slider Mapping widget determines which pots map to which
 
submasters.  It tells you the status of each mapping and saves and loads
 
presets.  The show is relying on this module!  Do not lose it!
 

	
 
FUQ (frequently unasked question(s))
 

	
 
1. What's with all the *args?
 

	
 
It lets functions take any number of arguments and throw them away.
 
Callbacks do this, and we typically don't care about what they have to say. """
 

	
 
from Tix import *
 
from uihelpers import FancyDoubleVar
 
from uihelpers import FancyDoubleVar, get_selection
 

	
 
stdfont = ('Arial', 8)
 

	
 
class SliderMapping:
 
    def __init__(self, default='disconnected', synced=0, extinputlevel=0, 
 
                 sublevel=0):
 
        self.subname = StringVar() # name of submaster we're connected to
 
        self.subname.set(default)
 
        self.sublevel = DoubleVar() # scalelevel variable of that submaster
 
        # self.sublevel = FancyDoubleVar() # scalelevel variable of that submaster
 
        self.sublevel.set(sublevel)
 
        self.synced = BooleanVar() # currently synced
 
        self.synced.set(synced)
 
        self.extlevel = DoubleVar() # external slider's input
 
        self.extlevel.set(extinputlevel)
 
        self.widgets = [] # list of widgets drawn
 
        self.sublabel = None # the label which represents a sub level.  
 
                             # we hold on to it so we can change its 
 
                             # textvariable
 
        self.statuslabel = None # tells us sync status
 
        self.lastbgcolor = None # last background color drawn to avoid 
 
                                # unnecessary redraws
 
        self.subnames = [] # we need to keep track of this for idiotic reasons
 
    def sync(self, *args):
 
        self.synced.set(1)
 
        self.color_bg()
 
    def unsync(self, *args):
 
        self.synced.set(0)
 
        self.color_bg()
 
    def issynced(self):
 
        return self.synced.get()
 
    def disconnect(self, *args):
 
        self.set_subname('disconnected') # a bit hack-like
 
        # self.sublevel.delete_named('sync')
 
        '''
 
        try:
 
            if self.sublevel.unsync_trace_cbname is not None:
 
                # self.sublevel.trace_vdelete('w', 
 
                    # self.sublevel.unsync_trace_cbname)
 
                self.sublevel._tk.call('trace', 'vdelete', self.sublevel._name, 
 
                    'w', self.sublevel.unsync_trace_cbname)
 
                self.sublevel.unsync_trace_cbname = None
 
        except AttributeError:
 
            pass
 
        '''
 
            
 
        self.sublabel.configure(text="N/A")
 
        self.color_bg()
 
    def isdisconnected(self):
 
        return self.subname.get() == 'disconnected' # a bit more hack-like
 
    def check_synced(self, *args):
 
        'If external level is near than the sublevel, it synces'
 
        if self.isdisconnected(): 
 
            self.unsync()
 
            return
 

	
 
        if abs(self.extlevel.get() - self.sublevel.get()) <= 0.02:
 
            self.sync()
 
    def changed_extinput(self, newlevel):
 
        'When a new external level is received, this incorporates it'
 
        self.extlevel.set(newlevel)
 
        self.check_synced()
 
        self.color_bg()
 
    def set_subname(self, newname):
 
        try:
 
            self.listbox.listbox.select_clear(0, END)
 
        except IndexError:
 
            pass
 
        try:
 
            newindex = self.subnames.index(newname)
 
            self.listbox.listbox.select_set(newindex)
 
            self.listbox.listbox.see(newindex)
 
        except ValueError:
 
            pass
 

	
 
        self.subname.set(newname)
 
        self.unsync()
 
        self.color_bg()
 
    def color_bg(self):
 
        if self.widgets:
 
            if self.isdisconnected():
 
                color = 'honeyDew4'
 
            # stupid hack
 
            # elif abs(self.extlevel.get() - self.sublevel.get()) <= 0.02:
 
            elif self.issynced():
 
                color = 'honeyDew2'
 
            else: # unsynced
 
                color = 'red'
 

	
 
            if self.statuslabel: # more stupid hackery
 
                if color == 'honeyDew2': # connected
 
                    self.statuslabel['text'] = 'Sync'
 
                elif self.extlevel.get() < self.sublevel.get():
 
                    self.statuslabel['text'] = 'No sync (go up)'
 
                else:
 
                    self.statuslabel['text'] = 'No sync (go down)'
 

	
 
            # print "color", color, "lastbgcolor", self.lastbgcolor
 
            if self.lastbgcolor == color: return
 
@@ -111,167 +123,182 @@ class SliderMapping:
 
            # self.sublevel.trace_named('sync', lambda *args: self.unsync(*args))
 
            '''
 
            try:
 
                if self.sublevel.unsync_trace_cbname is not None:
 
                    # remove an old trace
 
                    self.sublevel.trace_vdelete('w',
 
                        self.sublevel.unsync_trace_cbname)
 
            except AttributeError:
 
                pass # it didn't have one
 

	
 
            self.sublevel = newvar
 
            self.sublevel.unsync_trace_cbname = self.sublevel.trace('w', 
 
                self.unsync)
 
            '''
 

	
 
        # if self.sublabel:
 
            # self.sublabel.configure(textvariable=newvar)
 
        self.check_synced()
 
    def get_mapping(self):
 
        'Get name of submaster currently mapped'
 
        return self.subname.get()
 
    def get_level_pair(self):
 
        'Returns suitable output for ExtSliderMapper.get_levels()'
 
        return (self.subname.get(), self.extlevel.get())
 
    def listbox_cb(self, *args):
 
        self.subname.set(self.subnames[get_selection(self.listbox.listbox)-0])
 
    def draw_interface(self, master, subnames):
 
        'Draw interface into master, given a list of submaster names'
 
        frame = Frame(master)
 
        c = ComboBox(frame, variable=self.subname, dropdown=0)
 
        c.slistbox.listbox.insert(END, "disconnected")
 
        # c.listbox.insert(END, "disconnected")
 
        self.subnames = subnames
 
        frame = Frame(master, bg='black')
 
        self.listbox = ScrolledListBox(frame, scrollbar='y', bg='black')
 
        self.listbox.listbox.bind("<<ListboxSelect>>", self.listbox_cb, add=1)
 
        self.listbox.listbox.configure(font=stdfont, exportselection=0, 
 
            selectmode=BROWSE, bg='black', fg='white')
 
        self.listbox.vsb.configure(troughcolor='black')
 
        # self.listbox.listbox.insert(END, "disconnected")
 
        for s in subnames:
 
            c.slistbox.listbox.insert(END, s)
 
            # c.listbox.insert(END, s)
 
        c.entry.configure(width=12, font=stdfont)
 
        c.slistbox.listbox.configure(font=stdfont, exportselection=0)
 
        statframe = Frame(frame)
 
            self.listbox.listbox.insert(END, s)
 
        statframe = Frame(frame, bg='black')
 

	
 
        self.statuslabel = Label(statframe, text="No sync", width=15, font=stdfont)
 
        self.statuslabel = Label(statframe, text="No sync", width=15, 
 
            font=stdfont)
 
        self.statuslabel.grid(columnspan=2, sticky=W)
 
        ilabel = Label(statframe, text="Input", fg='blue', font=stdfont)
 
        ilabel.grid(row=1, sticky=W)
 
        extlabel = Label(statframe, textvariable=self.extlevel, width=5, font=stdfont)
 
        extlabel = Label(statframe, textvariable=self.extlevel, width=5, 
 
            font=stdfont)
 
        extlabel.grid(row=1, column=1)
 
        rlabel = Label(statframe, text="Real", font=stdfont)
 
        rlabel.grid(row=2, sticky=W)
 
        self.sublabel = Label(statframe, text="N/A", width=5, font=stdfont)
 
        self.sublabel.grid(row=2, column=1)
 
        disc_button = Button(statframe, text="Disconnect", 
 
            command=self.disconnect, padx=0, pady=0, font=stdfont)
 
        disc_button.grid(row=3, columnspan=2)
 
        statframe.pack(side=BOTTOM, expand=1, fill=BOTH)
 
        c.pack(expand=1, fill=BOTH)
 
        self.listbox.pack(expand=1, fill=BOTH)
 
        frame.pack(side=LEFT, expand=1, fill=BOTH)
 

	
 
        self.widgets = [frame, c, statframe, self.statuslabel, ilabel, extlabel,
 
                        rlabel, self.sublabel, disc_button]
 
        self.widgets = [frame, self.listbox, statframe, self.statuslabel, 
 
                        ilabel, extlabel, rlabel, self.sublabel, disc_button]
 

	
 
class ExtSliderMapper(Frame):
 
    def __init__(self, parent, sliderlevels, sliderinput, filename='slidermapping',
 
                 numsliders=4):
 
        'Slider levels is scalelevels, sliderinput is an ExternalInput object'
 
        Frame.__init__(self, parent)
 
        Frame.__init__(self, parent, bg='black')
 
        self.parent = parent
 
        self.sliderlevels = sliderlevels
 
        self.sliderinput = sliderinput
 
        self.filename = filename
 
        self.numsliders = numsliders
 
        self.file = None
 

	
 
        # don't call setup, let them do that when scalelevels is created
 
    def setup(self):
 
        self.subnames = self.sliderlevels.keys()
 
        self.subnames.sort()
 
        self.presets = {}
 
        self.load_presets()
 

	
 
        self.current_preset = StringVar() # name of current preset
 
        self.current_mappings = []
 
        for i in range(self.numsliders):
 
            self.current_mappings.append(SliderMapping())
 

	
 
        self.draw_interface()
 
    def load_presets(self):
 
        self.presets = {}
 
        self.file = open(self.filename, 'r')
 
        lines = self.file.readlines()
 
        for l in lines:
 
            tokens = l[:-1].split('\t')
 
            name = tokens.pop(0)
 
            self.presets[name] = tokens
 
        self.file.close()
 
    def save_presets(self):
 
        self.file = open(self.filename, 'w')
 
        self.file.seek(0)
 
        preset_names = self.presets.keys()
 
        preset_names.sort()
 
        for p in preset_names:
 
            s = '\t'.join([p] + self.presets[p]) + '\n'
 
            self.file.write(s)
 
        self.file.close()
 
    def load_scalelevels(self):
 
        for slidermap in self.current_mappings:
 
            try:
 
                v = self.sliderlevels[slidermap.get_mapping()]
 
                slidermap.set_sublevel_var(v)
 
                # print "ESM: Yes submaster named", slidermap.get_mapping()
 
            except KeyError:
 
                name = slidermap.get_mapping()
 
                if name != 'disconnected':
 
                    print "ESM: No submaster named", name
 
                
 
    def get_levels(self):
 
        'Called by changelevels, returns a dict of new values for submasters'
 
        if not self.sliderinput: return {}
 

	
 
        self.load_scalelevels() # freshen our input from the submasters
 

	
 
        rawlevels = self.sliderinput.get_levels()
 
        for rawlev, slidermap in zip(rawlevels, self.current_mappings):
 
            slidermap.changed_extinput(rawlev)
 

	
 
        return dict([m.get_level_pair()
 
            for m in self.current_mappings
 
            if m.issynced()])
 
    def draw_interface(self):
 
        self.reallevellabels = []
 
        subchoiceframe = Frame(self)
 
        subchoiceframe = Frame(self, bg='black')
 
        for m in self.current_mappings:
 
            m.draw_interface(subchoiceframe, self.subnames)
 
        subchoiceframe.pack()
 
        
 
        presetframe = Frame(self)
 
        Label(presetframe, text="Preset:").pack(side=LEFT)
 
        presetframe = Frame(self, bg='black')
 
        Label(presetframe, text="Preset:", font=('Arial', 10), bg='black', 
 
            fg='white').pack(side=LEFT)
 
        self.presetcombo = ComboBox(presetframe, variable=self.current_preset, 
 
                                    editable=1, command=self.apply_preset)
 
                                    editable=1, command=self.apply_preset,
 
                                    dropdown=1)
 
        self.presetcombo.slistbox.configure(bg='black')
 
        self.presetcombo.slistbox.listbox.configure(bg='black', fg='white')
 
        self.presetcombo.entry.configure(bg='black', fg='white')
 
        self.draw_presets()
 
        self.presetcombo.pack(side=LEFT)
 
        Button(presetframe, text="Add", padx=0, pady=0, 
 
        Button(presetframe, text="Add", padx=0, pady=0, bg='black', 
 
                fg='white', font=stdfont, 
 
                command=self.add_preset).pack(side=LEFT)
 
        Button(presetframe, text="Delete", padx=0, pady=0, 
 
        Button(presetframe, text="Delete", padx=0, pady=0, bg='black', 
 
                fg='white', font=stdfont,
 
                command=self.delete_preset).pack(side=LEFT)
 
        Button(presetframe, text="Disconnect", padx=0, pady=0, 
 
        Button(presetframe, text="Disconnect", padx=0, pady=0, bg='black', 
 
                fg='white', font=stdfont,
 
                command=self.disconnect_all).pack(side=LEFT)
 
        Button(presetframe, text="Reload", padx=0, pady=0, 
 
        Button(presetframe, text="Reload", padx=0, pady=0, bg='black', 
 
                fg='white', font=stdfont,
 
                command=self.load_presets).pack(side=LEFT)
 
        presetframe.pack(side=BOTTOM)
 
    def apply_preset(self, preset):
 
        if not preset: return
 
        preset_mapping = self.presets.get(preset)
 
        if not preset_mapping: return
 
        self.disconnect_all()
 
        for subname, slidermap in zip(preset_mapping, self.current_mappings):
 
            slidermap.set_subname(subname)
 
    def delete_preset(self, *args):
 
        del self.presets[self.current_preset.get()]
 
        self.presetcombo.slistbox.listbox.delete(0, END)
 
        self.draw_presets()
 
        self.save_presets()
 
    def add_preset(self, *args):
 
        self.presets[self.current_preset.get()] = [m.get_mapping() 
 
                for m in self.current_mappings]
 
        self.presetcombo.slistbox.listbox.delete(0, END)
 
        self.draw_presets()
 
        self.save_presets()
 
    def draw_presets(self):
 
        preset_names = self.presets.keys()
 
        preset_names.sort()
 
        for p in preset_names:
light8/Fader.py
Show inline comments
 
from Tix import *
 
from time import time # time is on my side
 
from util import subsetdict
 
from FlyingFader import FlyingFader
 
from uihelpers import get_selection
 

	
 
# statuses are:
 
# stopped - no cue is loaded or cue is stopped
 
# running - cue is running, not complete
 
# finished - cue is finished, next is loaded
 

	
 
stdfont = ('Arial', 10)
 

	
 
def get_selection(listbox):
 
    'Given a listbox, returns first selection as integer'
 
    selection = int(listbox.curselection()[0]) # blech
 
    return selection
 

	
 
class Fader(Frame):
 
    'User interface for cue fader'
 
    def __init__(self, master, cues, scalelevels):
 
        self.master = master
 
        self.cues = cues
 
        self.scalelevels = scalelevels
 
        self.time_start = 0
 
        self.init_layout()
 
        self.stop()
 
    def init_layout(self):
 
        Frame.__init__(self, self.master)
 

	
 
        # info variables
 
        self.cuename = StringVar()
 
        self.cuelength = DoubleVar()
 
        self.cuetarget = StringVar()
 

	
 
        # info about a running cue
 
        self.cuestatus = StringVar() # text description
 
        self.cuestatus.set("stopped")
 
        
 
        self.cuepercent = DoubleVar() # percent complete
 
        self.cuepercent.set(0)
 
        self.cuepercent.trace('w', self.update_percent)
light8/Lightboard.py
Show inline comments
 
@@ -17,110 +17,123 @@ class Pickles:
 
        self.scalelevels = dict([(name, lev.get()) 
 
            for name, lev in scalelevels.items()])
 
        self.substate = dict([(name, subobj.get_state())
 
            for name, subobj in subs])
 
        self.windowpos = windowpos
 

	
 
class Lightboard:
 
    def __init__(self, master, parportdmx, DUMMY):
 
        self.master = master
 
        self.parportdmx = parportdmx
 
        self.DUMMY = DUMMY
 
        self.jostle_mode = 0
 

	
 
        self.channel_levels = []
 
        self.scalelevels = {}
 
        # doesn't draw any UI yet-- look for self.xfader.setupwidget()
 
        self.xfader = Xfader(self.scalelevels) 
 
        self.oldlevels = [None] * 68 # never replace this; just clear it
 
        self.subediting = Subediting(currentoutputlevels=self.oldlevels)
 

	
 
        self.windowpos = 0
 
        self.get_data()
 
        self.buildinterface()
 
        self.load()
 
        print "Light 8.8: Enterring backgroundloop"
 
        self.backgroundloop()
 
        self.updatestagelevels()
 
        
 
    def buildinterface(self):
 
        print "Light 8.8: Constructing interface..."
 
        for w in self.master.winfo_children():
 
            w.destroy()
 

	
 
        print "\tstage"
 
        stage_tl = toplevelat('stage')
 
        s = stage.Stage(stage_tl)
 
        stage.createlights(s)
 
        s.setsubediting(self.subediting)
 
        s.pack()
 
        self.stage = s # save it
 

	
 
        sub_tl = toplevelat('sub')
 
        scene_tl = toplevelat('scenes')
 
        effect_tl = toplevelat('effect')
 

	
 
        print "\tslider patching"
 
        mapping_tl = toplevelat('mapping')
 
        self.slidermapper = ExtSliderMapper.ExtSliderMapper(mapping_tl, 
 
                                                            self.scalelevels, 
 
                                                            ExternalSliders())
 
        self.slidermapper.pack()
 

	
 
        print "\tsubmaster control"
 
        self.subpanels = Subpanels(sub_tl, effect_tl, scene_tl, self, self.scalelevels,
 
                                   Subs, self.xfader, self.changelevel,
 
                                   self.subediting, Subs.longestsubname())
 

	
 
        print "\tlevel display"
 
        leveldisplay_tl = toplevelat('leveldisplay')
 
        leveldisplay_tl.bind('<Escape>', sys.exit)
 

	
 
        self.leveldisplay = Leveldisplay(leveldisplay_tl, self.channel_levels)
 
        for i in range(0,len(self.channel_levels)):
 
            self.channel_levels[i].config(text=self.oldlevels[i])
 
            colorlabel(self.channel_levels[i])
 

	
 
        print "\tconsole"
 
        Console(self)
 

	
 
        # root frame
 
        print "\tcontrol panel"
 
        self.master.configure(bg='black')
 
        controlpanel = Controlpanel(self.master, self.xfader, self.refresh, 
 
            self.quit, self.toggle_jostle)
 
        
 
        print "\tcrossfader"
 
        xf=Frame(self.master)
 
        xf.pack(side='right')
 

	
 
        self.master.bind('<q>', self.quit)
 
        self.master.bind('<r>', self.refresh)
 
        leveldisplay_tl.bind('<q>', self.quit)
 
        leveldisplay_tl.bind('<r>', self.refresh)
 

	
 
        self.xfader.setupwidget(xf)
 
        controlpanel.pack()
 

	
 
        cuefader_tl = toplevelat('cuefader')
 
        cuefader = Fader(cuefader_tl, Subs.cues, self.scalelevels)
 
        cuefader.pack()
 
        print "\tcue fader (skipped)"
 
        # cuefader_tl = toplevelat('cuefader')
 
        # cuefader = Fader(cuefader_tl, Subs.cues, self.scalelevels)
 
        # cuefader.pack()
 
        print "Light 8.8: Everything's under control"
 

	
 

	
 
    def get_data(self,*args):
 
        Subs.reload_data(self.DUMMY)
 
        Patch.reload_data(self.DUMMY)
 
        print "Patch:", Patch.patch
 
        print "Subs:", ', '.join(Subs.subs.keys())
 
        print "Light 8.8:", len(Patch.patch), "dimmers patched"
 
        print "Light 8.8:", len(Subs.subs), "submasters loaded"
 

	
 
    def refresh(self, *args):
 
        'rebuild interface, reload data'
 
        self.get_data()
 
        self.subediting.refresh()
 
        self.buildinterface()
 
        bindkeys(self.master,'<Escape>', self.quit)
 
        self.slidermapper.setup()
 
        # self.master.tk_setPalette('gray40')
 

	
 
    def stageassub(self):
 
        """returns the current onstage lighting as a levels
 
        dictionary, skipping the zeros, and using names where
 
        possible"""
 
        levs=self.oldlevels
 
        
 
        return dict([(Patch.get_channel_name(i),l) for i,l
 
                     in zip(range(1,len(levs)+1),levs)
 
                     if l>0])
 
    def save_sub(self, name, levels, refresh=1):
 
        if not name:
 
            print "Enter sub name in console."
 
            return
 

	
 
@@ -155,71 +168,71 @@ class Lightboard:
 
                levels[ch-1] = max(levels[ch-1], fadelev)
 

	
 
        levels = [int(l) for l in levels]
 

	
 
        # load levels from external sliders
 
        extlevels = self.slidermapper.get_levels()
 
        for name, val in extlevels.items():
 
            if name in self.scalelevels:
 
                sl = self.scalelevels[name]
 
                # sl.disable_traces()
 
                sl.set(val)
 
                # sl.recreate_traces()
 
        
 
        for lev,lab,oldlev,numlab in zip(levels, self.channel_levels, 
 
                                         self.oldlevels, 
 
                                         self.leveldisplay.number_labels):
 
            if lev != oldlev:
 
                lab.config(text="%d" % lev) # update labels in lev display
 
                colorlabel(lab)             # recolor labels
 
                if lev < oldlev:
 
                    numlab['bg'] = 'blue'
 
                else:
 
                    numlab['bg'] = 'red'
 
            else:
 
                numlab['bg'] = 'lightPink'
 
                numlab['bg'] = 'grey40'
 

	
 
        self.oldlevels[:] = levels[:] # replace the elements in oldlevels - don't make a new list (Subediting is watching it)
 
            
 
        if self.jostle_mode:
 
            delta = random.randrange(-1, 2, 1) # (-1, 0, or 1)
 
            # print "delta", delta
 
            levels = [min(100, max(x + delta, 0)) for x in levels]
 
            # print "jostled", levels
 

	
 
        self.parportdmx.sendlevels(levels)
 

	
 
    def updatestagelevels(self):
 
        self.master.after(100, self.updatestagelevels)
 
        for lev, idx in zip(self.oldlevels, xrange(0, 68 + 1)):
 
            self.stage.updatelightlevel(Patch.get_channel_name(idx + 1), lev)
 

	
 
    def load(self):
 
        try:
 
            filename = '/tmp/light9.prefs'
 
            if self.DUMMY:
 
                filename += '.dummy'
 
            print "Loading from", filename
 
            print "Light 8.8: Loading from", filename
 
            file = open(filename, 'r')
 
            p = cPickle.load(file)
 
            for s, v in p.scalelevels.items():
 
                try:
 
                    self.scalelevels[s].set(v)
 
                except Exception,e:
 
                    print "Couldn't set %s -> %s: %s" % (s, v,e)
 
            for name, substate in p.substate.items():
 
                try:
 
                    Subs.subs[name].set_state(substate)
 
                except Exception, e:
 
                    print "Couldn't set sub %s state: %s" % (name,e)
 
        except IOError, e:
 
            print "IOError: Couldn't load prefs (%s): %s" % (filename,e)
 
        except EOFError, e:
 
            print "EOFrror: Couldn't load prefs (%s): %s" % (filename,e)
 
        except Exception,e:
 
            print "Couldn't load prefs (%s): %s" % (filename,e)
 
        self.slidermapper.setup()
 

	
 
    def backgroundloop(self, *args):
 
        self.master.after(50, self.backgroundloop, ())
 
        self.changelevel()
 
    def quit(self, *args):
light8/Xfader.py
Show inline comments
 
@@ -24,49 +24,49 @@ class Xfader(Canvas):
 
        
 
    def getoriglevel(self,subname):
 
        return self.startlevels[subname]
 
    def up(self,ev):
 
        self.startcoord=None
 
        self.delete('transient')
 
        # self.clearallbuttons()
 
    def moved(self,ev):
 
        if self.startcoord is None:
 
            return
 
        pos=(ev.x,-ev.y)
 
        deltas= self.sub2(pos,self.startcoord)
 
        for axis,delta in zip(('x','y'),deltas):
 
            onchan=self.onchannel[axis]
 
            for subn in onchan:
 
                newlev = self.getoriglevel(subn) + 1.0*delta/75
 
                newlev = int(newlev*1000)/1000.0
 
                newlev = min(1.0,max(newlev,0.0))
 
                scalelevels[subn].set( newlev )
 
    def width(self):
 
        return int(self['width'])
 
    def height(self):
 
        return int(self['height'])
 
    def setupwidget(self,parent):
 
        Canvas.__init__(self,parent,width=150,height=150,bg="#ff0000")
 
        Canvas.__init__(self,parent,width=150,height=150,bg="grey40")
 
        self.pack(side='bottom')
 
        self.create_rectangle(5,5,self.width()-5,self.height()-5)
 
        self.create_line(0,self.height()/2,150,self.height()/2)
 
        self.create_line(self.width()/2,0,self.width()/2,self.height())
 
        self.bind("<ButtonPress-1>",self.down)
 
        self.bind("<ButtonRelease-1>",self.up)
 
        self.bind("<B1-Motion>",self.moved)
 

	
 
    def registerbutton(self,subname,axis,checkvar):
 
        if subname not in self.checkbuttons:
 
            self.checkbuttons[subname]={}
 
        self.checkbuttons[subname][axis]=checkvar
 
    def clearallbuttons(self, axis='both'):
 
        for cb in self.checkbuttons.values():
 
            if axis == 'both':
 
                for a in cb.values():
 
                    a.set(0)
 
            else:
 
                cb[axis].set(0)
 
    def grab(self,axis):
 
        self.clearallbuttons(axis)
 
        for n,sv in scalelevels.items():
 
            if sv.get() and n != 'blacklight':
 
                self.checkbuttons[n][axis].set(1)
light8/panels.py
Show inline comments
 
"""some of the panels"""
 
from __future__ import nested_scopes
 

	
 
from Tix import *
 
from uihelpers import *
 
import Patch
 
from FlyingFader import FlyingFader
 

	
 
stdfont = ('Arial', 8)
 
monofont = ('Courier', 8)
 

	
 
class Controlpanel(Frame):
 
    def __init__(self, parent, xfader, refresh_cb, quit_cb, jostle_cb):
 
        Frame.__init__(self,parent)
 
        Frame.__init__(self,parent, bg='black')
 
        controlpanel = self
 
        for txt,cmd in (
 
            ('Quit',       quit_cb),
 
            ('Refresh',    refresh_cb),
 
            ('Clear all', xfader.clearallbuttons),
 
            ('On -> X',     lambda: xfader.grab('x')),
 
            ('Clear X',     lambda: xfader.clearallbuttons('x')),
 
            ('On -> Y',     lambda: xfader.grab('y')),
 
            ('Clear Y',     lambda: xfader.clearallbuttons('y'))):
 
            Button(controlpanel, text=txt, command=cmd).pack(side='top', 
 
                fill='x')
 
            Button(controlpanel, text=txt, command=cmd, bg='black', 
 
                fg='white').pack(side='top', fill='x')
 
        # jostle button
 
        Checkbutton(controlpanel, text="Jostle", 
 
        Checkbutton(controlpanel, text="Jostle", bg='black', fg='white',
 
            command=jostle_cb).pack(side=TOP, fill=X)
 

	
 
class Console:
 
    def __init__(self,lightboard):
 
        print "Light 8: Everything's under control"
 
        t=toplevelat('console')
 
        self.frame = Frame(t)
 
        self.entry=Entry(self.frame)
 
        self.frame = Frame(t, bg='black')
 
        self.entry=Entry(self.frame, bg='black', fg='white')
 
        self.entry.pack(expand=1, fill='x')
 
        self.entry.bind('<Return>',
 
                        lambda evt: self.execute(evt, self.entry.get()))
 
        self.frame.pack(fill=BOTH, expand=1)
 
        self.lightboard=lightboard
 
    
 
    def execute(self, evt, str):
 
        if str[0] == '*': # make a new sub from the current levels
 
            self.lightboard.save_sub(str,self.lightboard.stageassub())
 
        else:
 
            print '>>>', str
 
            print eval(str)
 
            self.frame.focus()
 

	
 
class Leveldisplay:
 
    def __init__(self, parent, channel_levels, num_channels=68):
 
        frames = (make_frame(parent), make_frame(parent))
 
        channel_levels[:]=[]
 
        self.number_labels = []
 
        for channel in range(1, num_channels+1):
 

	
 
            # frame for this channel
 
            f = Frame(frames[channel > (num_channels/2)])
 
            # channel number -- will turn yellow when being altered
 
            num_lab = Label(f, text=str(channel), width=3, bg='lightPink', 
 
                font=stdfont, padx=0, pady=0, bd=0, height=1)
 
            num_lab = Label(f, text=str(channel), width=3, bg='grey40', 
 
                fg='white', font=stdfont, padx=0, pady=0, bd=0, height=1)
 
            num_lab.pack(side='left')
 
            self.number_labels.append(num_lab)
 

	
 
            # text description of channel
 
            Label(f, text=Patch.get_channel_name(channel), width=8, 
 
                font=stdfont, anchor='w', padx=0, pady=0, bd=0, 
 
                height=1).pack(side='left')
 
                height=1, bg='black', fg='white').pack(side='left')
 

	
 
            # current level of channel, shows intensity with color
 
            l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e', 
 
                      padx=1, pady=0, bd=0, height=1)
 
            l.pack(side='left')
 
            colorlabel(l)
 
            channel_levels.append(l)
 
            f.pack(side='top')
 

	
 
        self.channel_levels = channel_levels
 
        # channel_levels is an output - changelevel will use it to access 
 
        # these labels
 

	
 
class Subpanels:
 
    def __init__(self, scenesparent, effectsparent, scenes, lightboard,
 
                 scalelevels, Subs, xfader,
 
                 changelevel, subediting, longestname):
 
        
 
        sublist = Subs.subs.items()
 
        sublist.sort()
 

	
 
        for p in scenesparent,effectsparent,scenes:
 
            sw = ScrolledWindow(p)
 
            sw = ScrolledWindow(p, bg='black')
 
            for but,units in ( (4,-4),(5,4) ):
 
                sw.window.bind("<ButtonPress-%s>"%but,lambda ev,s=sw.vsb,u=units: s.tk.call('tkScrollByUnits',s,'hv',u))
 

	
 
            sw.pack(expand=1,fill=BOTH)
 
            if p==scenesparent:
 
                scenesparent = sw.window
 
            elif p==effectsparent:
 
                effectsparent = sw.window
 
            else:
 
                scenes=sw.window
 

	
 
        for name, sub in sublist:
 
            # choose one of the sub panels to add to
 
            if sub.is_effect:
 
                parent=effectsparent
 
                side1='bottom'
 
                side2='left'
 
                orient1='vert'
 
                end1=0
 
                end2=1
 
                width1=len(name)
 
            elif name.startswith("*") and name[1].isdigit():
 
                parent=scenes
 
                side1='right'
 
                side2='top'
 
                orient1='horiz'
 
                end1=1
 
                end2=0
 
                width1=longestname
 
            else:
 
                parent=scenesparent
 
                side1='right'
 
                side2='top'
 
                orient1='horiz'
 
                end1=1
 
                end2=0
 
                width1=longestname
 

	
 
            # make frame that surrounds the whole submaster
 
            f=Frame(parent, bd=1, relief='raised')
 
            f=Frame(parent, bd=1, relief='raised', bg='black')
 
            f.pack(fill='both',exp=1,side=side2)
 
            
 

	
 
            # make DoubleVar (there might be one left around from
 
            # before a refresh)
 
            if name not in scalelevels:
 
                # scalelevels[name]=FancyDoubleVar()
 
                scalelevels[name]=DoubleVar()
 

	
 
            sub.set_slider_var(scalelevels[name])
 

	
 
            scaleopts = {'troughcolor' : 'grey70'}
 
            if sub.color:
 
                scaleopts['troughcolor'] = sub.color
 

	
 
            s = FlyingFader(f, label=str(name), variable=scalelevels[name],
 
                            showvalue=0, length=100,
 
                            width=14, sliderlength=14,
 
                            to=end1,res=.001,from_=end2,bd=1, font=stdfont,
 
                            orient=orient1,
 
                            labelwidth=width1,
 
                            **scaleopts)
 
            s.configure(bg='black')
 
            s.label.configure(bg='black', fg='white')
 
            s.vlabel.configure(bg='black', fg='white')
 
            s.scale.configure(bg='black', fg='white')
 

	
 
            # tell subediting what widgets to highlight when it's
 
            # editing a sub
 
            for w in (s,s.label,s.vlabel, s.scale):
 
                subediting.register(subname=name,widget=w)
 

	
 
            if not sub.is_effect:
 
                self.subeditingbuttons(f,side1,sub,name,lightboard,subediting)
 

	
 
            self.axisbuttons(f,s,xfader,stdfont,side1,name)
 

	
 
            s.pack(side='left', fill=BOTH, expand=1)
 

	
 
            # effects frame?
 
            sframe = Frame(f,bd=2,relief='groove')
 
            sub.draw_tk(sframe)
 
            sframe.pack(side='left',fill='y')
 

	
 
    def subediting_edit(self,subediting,sub):
 
        subediting.setsub(sub)
 
        
 
    def subediting_save(self,name,sub,lightboard):
 
        lightboard.save_sub(name,sub.getlevels(),refresh=0)
 
        
 
    def subeditingbuttons(self,f,side1,sub,name,lightboard,subediting):
 
        for txt,cmd in (("Edit",lambda subediting=subediting,sub=sub: self.subediting_edit(subediting,sub)),
 
                        ("Save",lambda sub=sub,name=name,lightboard=lightboard: self.subediting_save(name,sub,lightboard)),
 
                        ("SaveStg",lambda l=lightboard,name=name: l.save_sub(name,l.stageassub(),refresh=1)),
 
                        ):
 
            eb = Button(f,text=txt,font=stdfont,padx=0,pady=0,
 
                        bd=1,command=cmd)
 
                        bd=1,command=cmd, bg='black', fg='white')
 
            eb.pack(side=side1,fill='both',padx=0,pady=0)
 
            
 
    def axisbuttons(self,f,s,xfader,stdfont,side1,name):
 
        for axis in ('y','x'):
 
            cvar=IntVar()
 
            eb_color = ('red', 'green')[axis == 'y']
 
            cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, 
 
                            padx=3, pady=0, bd=1, downcolor=eb_color)
 
                            padx=3, pady=0, bd=1, downcolor=eb_color, 
 
                            bg='black', fg='white')
 
            cb.pack(side=side1,fill='both', padx=0, pady=0)
 
            s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke)
 
            xfader.registerbutton(name,axis,cvar)
light8/rsn.py
Show inline comments
 
#!/usr/bin/env python
 
from __future__ import nested_scopes
 

	
 
from Tix import *
 
from signal import signal, SIGINT
 
import io
 
from uihelpers import *
 
from Fader import Fader
 
from Lightboard import Lightboard
 

	
 
if len(sys.argv) >= 2:
 
    DUMMY = 0
 
    print "This is the real thing, baby"
 
    print "Light 8.8: This is the real thing, baby"
 
    window_title = "Light 8.8 (On Air)"
 
else:
 
    DUMMY = 1
 
    print "Dummy mode"
 
    print "Light 8.8: Dummy mode"
 
    window_title = "Light 8.8 (Bogus)"
 

	
 
root = Tk()
 
root.wm_title(window_title)
 
root.wm_geometry('+462+470')
 
root.tk_focusFollowsMouse()
 

	
 

	
 
parportdmx = io.ParportDMX()
 

	
 
if not DUMMY:
 
    # this turns the parportdmx from dummy to live
 
    print "Light 8.8: Preparing DMX interface..."
 
    parportdmx.golive()
 

	
 
print "Light 8.8: And this...is Mr. Lightboard"
 
mr_lightboard = Lightboard(root,parportdmx,DUMMY)
 
# root.tk_setPalette('gray40')
 

	
 
signal(SIGINT, mr_lightboard.quit)
 

	
 
#
 
# start net slider server in separate thread 
 
#
 
print "Light 8.8: External input server spawned"
 
import ExternalInput, thread
 
thread.start_new_thread(ExternalInput.start_server,())
 

	
 
bindkeys(root,'<Escape>', mr_lightboard.quit)
 

	
 
root.bind_class("all","<ButtonPress-4>",lambda ev: eventtoparent(ev,"<ButtonPress-4>"))
 
root.bind_class("all","<ButtonPress-5>",lambda ev: eventtoparent(ev,"<ButtonPress-5>"))
 

	
 
print 'Light 8.8: "Uh...Shiny McShine?"'
 
root.mainloop() # Receiver switches main
 

	
 
#import profile
 
#profile.run("root.mainloop()","profile/idlemanysubs")
light8/stage.py
Show inline comments
 
@@ -50,49 +50,49 @@ class Stage(Canvas):
 
        Canvas.__init__(self,parent,**kw)
 

	
 
        self.bind("<ButtonPress>", self.press)
 
        self.bind("<Motion>", self.motion)
 
        self.bind("<ButtonRelease>", self.release)
 
        self.bind("<Control-Key-a>", lambda ev: self.selectall())
 
        self.bind("<Control-Key-A>", lambda ev: self.clearselection())
 
#        self.bind("<Control-Shift-Key-a>",self.handlecontrol_a)
 
        
 
        self.halo=11 # search radius for clicked items
 

	
 
        self.mode=None # as you perform with the mouse, this goes
 
                       # from None to 'pressed','rectangle','levelchange', etc
 

	
 
        self.alllights=[]
 
        self.selectedlights=[]
 
        self.alllighttags={} # tag: name lookup
 

	
 
        self.subeditor = None
 

	
 

	
 
    def setimage(self,stageimage):
 
        img = Image('photo',file=stageimage)
 
        self.img=img # can't lose this!
 
        print img.width()
 
        # print img.width()
 
#        self.create_image(0,0,anchor='nw',image=img)
 
#        self.config(width=img.width(),height=img.height())
 

	
 
        # we had the picture removed for good luck, but we remember
 
        # what the dimensions formerly was
 
        self.config(width=821,height=681, bg="grey40")
 

	
 

	
 
    def setsubediting(self,subeditor):
 
        self.subeditor = subeditor
 

	
 
    # (17:00:06) drewp: if yes, then self.itemconfigure(tagOrId, text=...)
 
    def updatelightlevel(self, name, level):
 
        tag = self.nametag(name)
 
        self.itemconfigure("level_%s" % tag, text=level)
 

	
 
    #
 
    # selection management
 
    #
 
    def updateselectionboxes(self):
 
        "make selection boxes that match self.selectedlights"
 
        self.delete("selectbox")
 
        for l in self.selectedlights:
 
            for c in self.getlightbboxes(l):
light8/uihelpers.py
Show inline comments
 
"""all the tiny tk helper functions"""
 

	
 
from __future__ import nested_scopes
 
from Tkinter import *
 
from Tix import *
 
from types import StringType
 

	
 
windowlocations = {
 
    'sub' : '425x738+00+00',
 
    'console' : '168x24+848+000',
 
    'leveldisplay' : '144x340+870+400',
 
    'cuefader' : '314x212+546+741',
 
    'effect' : '24x24+0963+338',
 
    'stage' : '823x683+37+030',
 
    'scenes' : '504x198+462+12',
 
}
 

	
 
def make_frame(parent):
 
    f = Frame(parent, bd=0)
 
    f = Frame(parent, bd=0, bg='black')
 
    f.pack(side='left')
 
    return f
 

	
 
def bindkeys(root,key, func):
 
    root.bind(key, func)
 
    for w in root.winfo_children():
 
        w.bind(key, func)
 

	
 

	
 
def toplevel_savegeometry(tl,name):
 
    try:
 
        geo = tl.geometry()
 
        if not geo.startswith("1x1"):
 
            f=open(".light9-window-geometry-%s" % name.replace(' ','_'),'w')
 
            f.write(tl.geometry())
 
        # else the window never got mapped
 
    except:
 
        # it's ok if there's no saved geometry
 
        pass
 

	
 
    # this would get called repeatedly for each child of the window (i
 
    # dont know why) so we unbind after the first Destroy event
 
    tl.unbind("<Destroy>",tl._toplevelat_funcid)
 

	
 
@@ -54,49 +54,54 @@ def toplevelat(name):
 
    if name in windowlocations:
 
        tl.geometry(windowlocations[name])
 

	
 
    tl._toplevelat_funcid=tl.bind("<Destroy>",lambda ev,tl=tl,name=name: toplevel_savegeometry(tl,name))
 

	
 
    return tl
 

	
 
def toggle_slider(s):
 
    if s.get() == 0:
 
        s.set(100)
 
    else:
 
        s.set(0)
 

	
 
# for lambda callbacks    
 
def printout(t):
 
    print t
 

	
 
def printevent(ev):
 
    for k in dir(ev):
 
        if not k.startswith('__'):
 
            print k,getattr(ev,k)
 
    print ""
 
    
 
def eventtoparent(ev,sequence):
 
    "passes an event to the parent"
 
    "passes an event to the parent, screws up TixComboBoxes"
 

	
 
    wid_class = str(ev.widget.__class__)
 
    if wid_class == 'Tix.ComboBox' or wid_class == 'Tix.TixSubWidget':
 
        return
 

	
 
    evdict={}
 
    for x in ['state', 'time', 'y', 'x', 'serial']:
 
        evdict[x]=getattr(ev,x)
 
#    evdict['button']=ev.num
 
    par=ev.widget.winfo_parent()
 
    if par!=".":
 
        ev.widget.nametowidget(par).event_generate(sequence,**evdict)
 
    #else the event made it all the way to the top, unhandled
 

	
 
def colorlabel(label):
 
    """color a label based on its own text"""
 
    txt=label['text'] or "0"
 
    lev=float(txt)/100
 
    low=(80,80,180)
 
    high=(255,55,050)
 
    out = [int(l+lev*(h-l)) for h,l in zip(high,low)]
 
    col="#%02X%02X%02X" % tuple(out)
 
    label.config(bg=col)
 

	
 
# TODO: get everyone to use this
 
def colorfade(low, high, percent):
 
    '''not foolproof.  make sure 0 < percent < 1'''
 
    out = [int(l+percent*(h-l)) for h,l in zip(high,low)]
 
    col="#%02X%02X%02X" % tuple(out)
 
@@ -187,46 +192,39 @@ class FancyDoubleVar(DoubleVar):
 
#            self.trace_variable(v[0],v[1])
 
            self._tk.call("trace", "variable", self._name, mode,cb)
 

	
 
    def trace_named(self, name, callback):
 
        if name in self.namedtraces:
 
            print "FancyDoubleVar: already had a trace named %s - replacing it" % name
 
            self.delete_named(name)
 

	
 
        cbname = self.trace_variable('w',callback) # this will register in self.callbacklist too
 
        
 
        self.namedtraces[name] = cbname
 
        return cbname
 
        
 
    def delete_named(self, name):
 
        if name in self.namedtraces:
 

	
 
            cbname = self.namedtraces[name]
 
            
 
            self.trace_vdelete('w',cbname)
 
	    #self._tk.call("trace","vdelete",self._name,'w',cbname)
 
            print "FancyDoubleVar: successfully deleted trace named %s" % name
 
        else:
 
            print "FancyDoubleVar: attempted to delete named %s which wasn't set to any function" % name
 

	
 

	
 

	
 
def get_selection(listbox):
 
    'Given a listbox, returns first selection as integer'
 
    selection = int(listbox.curselection()[0]) # blech
 
    return selection
 

	
 
if __name__=='__main__':
 
    root=Tk()
 
    root.tk_focusFollowsMouse()
 
    iv=IntVar()
 
    def cb():
 
        print "cb!"
 
    t = Togglebutton(root,text="testbutton",command=cb,variable=iv)
 
    t.pack()
 
    Entry(root,textvariable=iv).pack()
 
    root.mainloop()
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
0 comments (0 inline, 0 general)