annotate light8/stage.py @ 53:032b2b67bc10

result of July 7th on-site editing
author dmcc
date Mon, 08 Jul 2002 14:31:20 +0000
parents 71489bb71528
children 2f2eb802e93d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
71489bb71528 - Meet Fader. He is going to grow up and be a crossfader some day
dmcc
parents: 44
diff changeset
1 from Tix import *
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
2
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
3 def printevent(ev):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
4 for k in dir(ev):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
5 if not k.startswith('__'):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
6 print k,getattr(ev,k)
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
7 print ""
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
8
53
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
9 textstyle={'font':'arial 9','fill':'white'}
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
10
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 class Stage(Canvas):
45b12307c695 Initial revision
drewp
parents:
diff changeset
12
45b12307c695 Initial revision
drewp
parents:
diff changeset
13 """a fancy widget that shows light locations (and optionally their
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 aim locations on an image of the stage. you can select or
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 multiselect lights and drag them up or down to change their
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 brightness.
45b12307c695 Initial revision
drewp
parents:
diff changeset
17
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 ctrl-a is select all,
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 ctrl-shift-a or clicking on no light deselects all,
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 re-clicking a light with shift key down toggles whether it's in the selection.
45b12307c695 Initial revision
drewp
parents:
diff changeset
21 ctrl-drag-rectangle deselects the lights in the rectangle,
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 shift-drag-rectangle selects the lights in the rectangle,
45b12307c695 Initial revision
drewp
parents:
diff changeset
23 drag-rectangle selects only the lights in the rectangle.
45b12307c695 Initial revision
drewp
parents:
diff changeset
24
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
25 a light can be selected on its location point, its aim point
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
26 (which may or may not be present), or its name.
45b12307c695 Initial revision
drewp
parents:
diff changeset
27
45b12307c695 Initial revision
drewp
parents:
diff changeset
28 lights should be able to be interactively 'locked', which blocks
45b12307c695 Initial revision
drewp
parents:
diff changeset
29 them from being selected.
45b12307c695 Initial revision
drewp
parents:
diff changeset
30
17
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
31 API:
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
32 __init__(parent,**kw)
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
33 put pass any canvas options you want
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
34
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
35 setimage(stageimage)
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
36 sets image to given filename (ppm, gif, etc) and resizes the
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
37 canvas to the image size
17
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
38
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
39 addlight(name, location, aim=None)
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
40 location and aim are pixel coord tuples. name will be passed
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
41 back to you in the callback (see below)
17
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
42
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
43 setsubediting(se)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
44 give a subediting object to receive the 'startlevelchange' and
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
45 'levelchange' messages
17
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
46
43aa1ee8b3a9 some comments and garbage cleanup
drewp
parents: 14
diff changeset
47
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
48 """
45b12307c695 Initial revision
drewp
parents:
diff changeset
49 def __init__(self,parent,**kw):
45b12307c695 Initial revision
drewp
parents:
diff changeset
50 Canvas.__init__(self,parent,**kw)
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
51
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
52 self.bind("<ButtonPress>", self.press)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
53 self.bind("<Motion>", self.motion)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
54 self.bind("<ButtonRelease>", self.release)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
55 self.bind("<Control-Key-a>", lambda ev: self.selectall())
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
56 self.bind("<Control-Key-A>", lambda ev: self.clearselection())
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
57 # self.bind("<Control-Shift-Key-a>",self.handlecontrol_a)
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
58
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
59 self.halo=11 # search radius for clicked items
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
60
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
61 self.mode=None # as you perform with the mouse, this goes
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
62 # from None to 'pressed','rectangle','levelchange', etc
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
63
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
64 self.alllights=[]
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
65 self.selectedlights=[]
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
66 self.alllighttags={} # tag: name lookup
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
67
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
68 self.subeditor=None
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
69
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
70 def setimage(self,stageimage):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
71 img = Image('photo',file=stageimage)
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
72 self.img=img # can't lose this!
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
73 print img.width()
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
74 self.create_image(0,0,anchor='nw',image=img)
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
75 self.config(width=img.width(),height=img.height())
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
76
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
77 def setsubediting(self,subeditor):
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
78 self.subeditor = subeditor
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
79 #
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
80 # selection management
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
81 #
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
82 def updateselectionboxes(self):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
83 "make selection boxes that match self.selectedlights"
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
84 self.delete("selectbox")
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
85 for l in self.selectedlights:
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
86 for c in self.getlightbboxes(l):
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
87 self.create_rectangle(c[0]-2,c[1]-2,c[2]+2,c[3]+2,
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
88 outline='red',tag="selectbox")
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
89
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
90 def selectall(self):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
91 self.selectedlights= self.alllights[:]
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
92 self.updateselectionboxes()
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
93 def clearselection(self):
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
94 self.selectedlights=[]
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
95 self.updateselectionboxes()
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
96
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
97 def markfordynselection(self):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
98 """call this before calls to replacedynselection"""
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
99 self.origselection = self.selectedlights[:]
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
100
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
101 def replacedynselection(self,newlightnames,subtract=0):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
102 """as a dynamic selection changes, keep calling this function
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
103 with the names of the lights in the dynamic selection. the
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
104 original selection (at the time of markfordynselection) will
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
105 be shown along with any new lights. if subtract=1, the selection will
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
106 be shown MINUS the newlights."""
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
107 if subtract==0:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
108 # orig selection plus any newlights that weren't in the orig selection
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
109 self.selectedlights = self.origselection[:] + [l for l in newlightnames if l not in self.origselection]
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
110 else:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
111 # orig selection lights except those that are in the newlightnames list
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
112 self.selectedlights = [l for l in self.origselection if l not in newlightnames]
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
113 self.updateselectionboxes()
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
114
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
115 def select(self,lightname,select=1): # select=0 for deselect
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
116 """select or deselect (select=0) a light by name"""
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
117 if select:
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
118 if lightname not in self.selectedlights:
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
119 self.selectedlights.append(lightname)
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
120 elif lightname in self.selectedlights:
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
121 self.selectedlights.remove(lightname)
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
122
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
123 self.updateselectionboxes()
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
124
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
125
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
126 #
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
127 # mouse handling
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
128 #
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
129 def press(self,ev):
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
130
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
131 self.mode='pressed'
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
132 self.mousedownpos=(ev.x,ev.y)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
133 print "click at",self.mousedownpos
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
134
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
135 button=ev.num
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
136 shifted=ev.state & 1
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
137 control=ev.state & 4
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
138 touching=self.findoverlappinglights((ev.x-self.halo,ev.y-self.halo,
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
139 ev.x+self.halo,ev.y+self.halo))
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
140 istouching=len(touching)>0
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
141
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
142 if button==1:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
143 if not istouching:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
144 # clicked in space
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
145 if not shifted and not control and len(self.selectedlights)>0:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
146 # either a deselect (if no motion) or a level change (if motion)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
147 self.mode = 'deselect-or-rectangle'
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
148 if shifted or control or len(self.selectedlights)==0:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
149 # with shift/control, add/subtract lights to selection
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
150 self.startrectangleselect()
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
151
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
152 else:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
153 # clicked a selectable object
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
154 # toggle selection
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
155 if touching[0] in self.selectedlights:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
156 if shifted or control:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
157 # deselect
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
158 self.select(touching[0],0)
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
159 # and do nothing else
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
160 self.mode=None
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
161 if not shifted:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
162 # select only this light
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
163 self.clearselection()
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
164 self.select(touching[0])
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
165 # and adjust its level
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
166 self.startlevelchange()
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
167
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
168 else:
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
169 # clicked a light that wasn't selected
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
170 if not shifted:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
171 self.clearselection()
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
172 self.select(touching[0])
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
173 # and adjust levels now
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
174 self.startlevelchange()
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
175
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
176 if button==3:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
177 self.startlevelchange()
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
178
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
179 def motion(self,ev):
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
180
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
181 coords=(ev.x,ev.y)
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
182
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
183 shifted=ev.state & 1
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
184 control=ev.state & 4
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
185
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
186 if self.mode=='deselect-or-rectangle':
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
187 if (coords[0]-self.mousedownpos[0])**2+(coords[1]-self.mousedownpos[1])**2>self.halo**2:
53
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
188 if not shifted and not control:
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
189 self.clearselection()
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
190 # they moved enough, it's a level change
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
191 self.startrectangleselect()
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
192
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
193
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
194 if self.mode=='levelchange':
53
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
195 delta = 1.5 * (self.mousedownpos[1]-ev.y)
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
196 if self.subeditor:
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
197 self.subeditor.levelchange(self.selectedlights,delta)
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
198
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
199 if self.mode=='rectangle':
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
200 sr = self.find_withtag('selectrect')
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
201 if not sr:
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
202 # make the selection rectangle
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
203 sr=self.create_rectangle( self.mousedownpos[0],self.mousedownpos[1],coords[0],coords[1],
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
204 outlinestipple='gray50',outline='yellow',tag='selectrect')
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
205
8
6faae180d1c5 conv image to gif, clean up source formatting
drewp
parents: 7
diff changeset
206 # move rectangle with mouse
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
207 self.coords(sr,*(self.mousedownpos+coords))
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
208
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
209 # redo the dynselection with the new rectangle
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
210 self.replacedynselection(self.findoverlappinglights((self.mousedownpos+coords),1),
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
211 subtract=control)
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
212
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
213 def release(self,ev):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
214 if self.mode:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
215 if self.mode=='rectangle':
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
216 self.delete('selectrect')
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
217
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
218 if self.mode=='deselect-or-rectangle':
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
219 # they didn't move enough to promote the mode to level, so it's a deselect click
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
220 self.clearselection()
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
221
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
222 self.mode=None
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
223
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
224 #
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
225 #
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
226 #
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
227
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
228 def startlevelchange(self):
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
229 """sets mode to levelchange AND notifies subeditor. this
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
230 should be done exactly once (per mouse drag), when you first
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
231 decide the mode is levelchange"""
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
232 self.mode='levelchange'
37
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
233 if self.subeditor:
115636cca107 subeditor begins to work - stage makes the right calls to subeditor now
drewp
parents: 17
diff changeset
234 self.subeditor.startlevelchange()
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
235 def startrectangleselect(self):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
236 """sets mode to rectangle AND checkpoints the current selection"""
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
237 self.mode='rectangle'
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
238 self.markfordynselection()
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
239 #
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
240 # light names vs. canvas object tags
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
241 #
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
242 def nametag(self,name):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
243 "returns a safe version of the name that won't match other names"
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
244 return name.replace(" ","__")
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
245
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
246 def tagtoname(self,tag):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
247 "finds the real light name for a tag written by nametag()"
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
248 return self.alllighttags[tag]
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
249
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
250 #
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
251 # light methods
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
252 #
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
253 def addlight(self,name,location,aim=None):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
254 tags='light selectable name_%s' % self.nametag(name)
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
255
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
256 self.create_oval(location[0]-2,location[1]-2,
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
257 location[0]+2,location[1]+2,
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
258 fill='red',tag=tags+" hotspot")
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
259 if aim:
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
260 self.create_oval(aim[0]-2,aim[1]-2,
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
261 aim[0]+2,aim[1]+2,
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
262 fill='red',tag=tags+" hotspot")
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
263 self.create_line(location[0],location[1],aim[0],aim[1],fill='lightblue',
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
264 arrow='last',arrowshape="9 15 6",tag='light')
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
265 # shadow
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
266 self.create_text(location[0]-1,location[1]+6,
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
267 anchor='n',text=name,fill='black',
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
268 tag=tags,**dict([(k,v) for k,v in textstyle.items() if k!='fill']))
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
269 # text
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
270 self.create_text(location[0],location[1]+5,anchor='n',text=name,tag=tags,**textstyle)
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
271
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
272 self.alllights.append(name)
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
273 self.alllighttags[self.nametag(name)]=name
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
274
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
275 def getlightbboxes(self,tag):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
276 """returns a list of bboxes for a light with a given name_ tag. the selection
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
277 mechanism draws around these bboxes to show that a light is selected"""
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
278 bboxes=[]
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
279 for o in self.find_withtag("name_%s" % self.nametag(tag)):
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
280 if 'hotspot' in self.gettags(o):
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
281 bboxes.append(self.bbox(o))
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
282 return bboxes
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
283
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
284 def findoverlappinglights(self,box,enclosed=0):
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
285 "returns all the different names for lights that are within (or enclosed by) the box"
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
286 lights=[]
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
287 if enclosed:
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
288 candidates = self.find_enclosed(*box)
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
289 else:
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
290 candidates = self.find_overlapping(*box)
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
291
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
292 for o in candidates:
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
293 for t in self.gettags(o):
7
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
294 if t.startswith("name_"):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
295 n = self.tagtoname(t[5:])
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
296 if n and (n not in lights):
1b0266dd233a picking and dragging works pretty well (no ctrl yet)
drewp
parents: 6
diff changeset
297 lights.append(n)
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
298 return lights
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
299
10
533ac835083f some real lights
drewp
parents: 8
diff changeset
300
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
301 def createlights(s):
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
302 s.setimage('guysanddolls.gif')
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
303 s.addlight('desk1',(46, 659), aim=(210, 381))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
304 s.addlight('marry1',(78, 661), aim=(398, 428))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
305 s.addlight('b13',(110, 661))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
306 s.addlight('hotbox1',(147, 657), aim=(402, 327))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
307 s.addlight('edge',(179, 651), aim=(116, 441))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
308 s.addlight('phone',(214, 652), aim=(651, 417))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
309 s.addlight('cuba1',(315, 656), aim=(559, 407))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
310 s.addlight('b22',(347, 661), aim=(247, 458))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
311 s.addlight('b23',(379, 661))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
312 s.addlight('b24',(417, 661))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
313 s.addlight('b25',(455, 658), aim=(520, 466))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
314 s.addlight('desk2',(490, 655), aim=(237, 375))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
315 s.addlight('rock',(571, 655), aim=(286, 304))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
316 s.addlight('b32',(606, 650))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
317 s.addlight('hotbox2',(637, 650), aim=(433, 337))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
318 s.addlight('b34',(671, 651))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
319 s.addlight('marry2',(703, 651), aim=(429, 426))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
320 s.addlight('cuba2',(733, 652), aim=(602, 408))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
321
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
322 s.addlight('sidefill1',(115, 473),aim=(228, 423))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
323 s.addlight('sidefill2',(617, 475),aim=(526, 425))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
324
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
325 s.addlight('cycright',(485, 164),(483, 109))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
326 s.addlight('cycleft',(330, 154),(333, 108))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
327
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
328 s.addlight('upfill1',(275, 325),(262, 237))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
329 s.addlight('upfill2',(333, 326),(330, 229))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
330 s.addlight('upfill3',(473, 325),(454, 226))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
331 s.addlight('upfill4',(541, 325),(528, 223))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
332
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
333 s.addlight('god',(369,549))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
334
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
335 s.addlight('patio1',(42, 560),(12, 512))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
336 s.addlight('patio2',(675, 553),(793, 514))
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
337
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
338 s.addlight('hotback',(413, 476),(414, 396))
10
533ac835083f some real lights
drewp
parents: 8
diff changeset
339
53
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
340 s.addlight('main 2',(120, 563) ,aim=(241, 472))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
341 s.addlight('main 3',(162, 562) ,aim=(140, 425))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
342 s.addlight('main 4',(208, 560) ,aim=(342, 423))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
343 s.addlight('main 5',(259, 558) ,aim=(433, 450))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
344 s.addlight('main 7',(494, 551) ,aim=(420, 458))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
345 s.addlight('main 8',(528, 554) ,aim=(503, 477))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
346 s.addlight('main 9',(559, 554) ,aim=(544, 479))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
347 s.addlight('main 10',(597, 556),aim=(339, 444))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
348 s.addlight('main 11',(636, 556),aim=(449, 409))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
349
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
350 s.addlight('sidepost2', (785, 609))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
351 s.addlight('sidepost1', (8, 613))
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
352
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
353
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
354
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
355
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
356
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
357
032b2b67bc10 result of July 7th on-site editing
dmcc
parents: 51
diff changeset
358
6
119369e60da1 tag-heavy selection management is getting hard - about to switch to python lists
drewp
parents: 5
diff changeset
359
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
360
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
361 if __name__=='__main__':
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
362 root=Tk()
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
363 root.tk_focusFollowsMouse()
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
364 root.wm_geometry("+376+330")
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
365 s=Stage(root)
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
366 s.setimage('guysanddolls.gif')
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
367 s.pack()
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
368
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
369 createlights(s)
44
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
370
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
371 class subediting_standin:
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
372 def startlevelchange(self):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
373 print "start lev change"
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
374 def levelchange(self,lights,delta):
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
375 print "change",lights,delta
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
376 s.setsubediting(subediting_standin())
6540879e336e fixed Stage a lot: ctrl-drag subtracts from selection; ctrl-a/ctrl-A select all/none;
drewp
parents: 37
diff changeset
377
14
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
378 root.mainloop()
95ba7e14d15a new colors
drewp
parents: 10
diff changeset
379