Changeset - 115636cca107
[Not reviewed]
default
0 1 0
drewp - 22 years ago 2002-07-07 12:16:03

subeditor begins to work - stage makes the right calls to subeditor now
1 file changed with 14 insertions and 6 deletions:
0 comments (0 inline, 0 general)
light8/stage.py
Show inline comments
 
@@ -58,20 +58,23 @@ class Stage(Canvas):
 
        self.lmbstate=None # as you perform with LMB, this goes from None to 'pressed','rectangle','levelchange'
 

	
 
        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()
 
        self.create_image(0,0,anchor='nw',image=img)
 
        self.config(width=img.width(),height=img.height())
 
        
 

	
 
    def setsubediting(self,subeditor):
 
        self.subeditor = subeditor
 
    #
 
    # selection management
 
    #
 
    def updateselectionboxes(self):
 
        "make selection boxes that match self.selectedlights"
 
        self.delete("selectbox")
 
@@ -138,21 +141,21 @@ class Stage(Canvas):
 
                    self.lmbstate=None
 
                else:
 
                    # select only this light
 
                    self.clearselection()
 
                    self.select(touching[0])
 
                    # and adjust its level
 
                    self.lmbstate='levelchange'
 
                    self.startlevelchange()
 
                    
 
            else:
 
                # clicked a light that wasn't selected
 
                if not shifted:
 
                    self.clearselection()
 
                self.select(touching[0])
 
                # and adjust levels now
 
                self.lmbstate='levelchange'
 
                self.startlevelchange()
 
                
 
        if self.lmbstate=='rectangle':
 
            self.markfordynselection()
 
    def leftmotion(self,ev):
 

	
 
        coords=(ev.x,ev.y)
 
@@ -160,17 +163,18 @@ class Stage(Canvas):
 
        shifted=ev.state & 1
 
        control=ev.state & 4
 

	
 
        if self.lmbstate=='deselect-or-level':
 
            if (coords[0]-self.lmbstart[0])**2+(coords[1]-self.lmbstart[1])**2>self.halo**2:
 
                # they moved enough, it's a level change
 
                self.lmbstate='levelchange'
 
                self.startlevelchange()
 

	
 
        if self.lmbstate=='levelchange':
 
            delta = self.lmbstart[1]-ev.y
 
            print "change by",delta
 
            delta = (self.lmbstart[1]-ev.y)
 
            if self.subeditor:
 
                self.subeditor.levelchange(self.selectedlights,delta)
 

	
 
        if self.lmbstate=='rectangle':
 
            sr = self.find_withtag('selectrect')
 
            if not sr:
 
                sr=self.create_rectangle( self.lmbstart[0],self.lmbstart[1],coords[0],coords[1],
 
                                          outlinestipple='gray50',outline='yellow',
 
@@ -195,12 +199,16 @@ class Stage(Canvas):
 
                self.clearselection()
 
            
 
            # all items that were in dynselection join the selection
 
#            self.incorporatedynselection()
 
            
 
        self.lmbstate=None
 
    def startlevelchange(self):
 
        self.lmbstate='levelchange'
 
        if self.subeditor:
 
            self.subeditor.startlevelchange()
 

	
 
    #
 
    # light names vs. canvas object tags
 
    #
 
    def nametag(self,name):
 
        "returns a safe version of the name that won't match other names"
0 comments (0 inline, 0 general)