Changeset - e9d2e7754fd9
[Not reviewed]
default
0 3 0
drewp - 22 years ago 2002-07-07 10:48:38

sideways subs, new x/y buttons (which don't draw right, but they work)
3 files changed with 64 insertions and 11 deletions:
0 comments (0 inline, 0 general)
light8/panels.py
Show inline comments
 
@@ -4,6 +4,7 @@ from Tkinter import *
 
from uihelpers import *
 
import Patch
 
from FlyingFader import FlyingFader
 
import Pmw
 

	
 
stdfont = ('Arial', 8)
 
monofont = ('Courier', 8)
 
@@ -82,14 +83,21 @@ class Subpanels:
 
        sublist.sort()
 

	
 
        for name, sub in sublist:
 
            # choose one of the sub panels to add to
 
            if sub.is_effect:
 
                parent=effectsparent
 
                side1='bottom'
 
                orient='vert'
 
            else:
 
                parent=scenesparent
 
                side1='right'
 
                orient='horiz'
 

	
 
            # make frame that surrounds the whole submaster
 
            f=Frame(parent, bd=1, relief='raised')
 
            f.pack(fill='both',exp=1,side='left')
 
            f.pack(fill='both',exp=1,side=('top','left')[sub.is_effect])
 

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

	
 
@@ -100,17 +108,19 @@ class Subpanels:
 
                scaleopts['troughcolor'] = sub.color
 

	
 
            s = FlyingFader(f, label=str(name), variable=scalelevels[name],
 
                    showvalue=0, length=300-17,
 
                    width=20, to=0,res=.001,from_=1,bd=1, font=stdfont,
 
                    **scaleopts)
 
                            showvalue=0, length=300-17,
 
                            width=18, sliderlength=18,
 
                            to=1,res=.001,from_=0,bd=0, font=stdfont,
 
                            orient=orient,
 
                            labelwidth=12, # this should be equal to the longest label name
 
                            **scaleopts)
 

	
 
            for axis in ('y','x'):
 
                cvar=IntVar()
 
                cb=Checkbutton(f,text=axis,variable=cvar,font=stdfont, padx=0, 
 
                cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, padx=0, 
 
                               pady=0, bd=1)
 
                button = ('Alt','Control')[axis=='y'] # unused?
 
                # s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke)
 
                cb.pack(side='bottom',fill='both', padx=0, pady=0)
 
                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)
 

	
 
            s.pack(side='left', fill=BOTH)
light8/rsn.py
Show inline comments
 
@@ -23,7 +23,7 @@ else:
 

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

	
 
import Subs, Patch
 
@@ -53,13 +53,13 @@ class Lightboard:
 
        for w in self.master.winfo_children():
 
            w.destroy()
 

	
 
        stage_tl = toplevelat(165,90)
 
        stage_tl = toplevelat(65,37)
 
        s = stage.Stage(stage_tl)
 
        stage.createlights(s)
 
        s.pack()
 

	
 
        sub_tl = toplevelat(0,0)
 
        effect_tl = toplevelat(0,352)
 
        effect_tl = toplevelat(462,4)
 

	
 
        self.xfader = Xfader(self.scalelevels)
 

	
light8/uihelpers.py
Show inline comments
 
@@ -39,3 +39,46 @@ def colorlabel(label):
 
    out = [int(l+lev*(h-l)) for h,l in zip(high,low)]
 
    col="#%02X%02X%02X" % tuple(out)
 
    label.config(bg=col)
 

	
 
class Togglebutton(Button):
 
    """works like a single radiobutton, but it's a button so the label's on the button face, not to the side"""
 
    def __init__(self,parent,**kw):
 
        if kw['variable']:
 
            self.variable = kw['variable']
 
            self.variable.trace('w',self.varchanged)
 
            del kw['variable']
 
        else:
 
            self.variable=None
 
        self.oldcommand = kw.get('command',None)
 
        kw['command'] = self.invoke
 
        Button.__init__(self,parent,**kw)
 

	
 
        self.origbkg = self.cget('bg')
 

	
 
        self.state=0
 
        if self.variable:
 
            self.state = self.variable.get()
 

	
 
        self.setstate(self.state)
 

	
 
        self.bind("<Enter>",lambda ev: self.setstate)
 
        self.bind("<Leave>",lambda ev: self.setstate)
 

	
 
    def varchanged(self,*args):
 
        self.setstate(self.variable.get())
 
        
 
    def invoke(self):
 
        self.setstate(not self.state)
 
        
 
        if self.oldcommand:
 
            self.oldcommand()
 

	
 
    def setstate(self,newstate):
 
        self.variable.set(newstate)
 
        if newstate: # set
 
            self.tk.call('tkButtonDown',self)
 
            self.config(bg='green')
 
        else: # unset
 
            self.tk.call('tkButtonUp',self)
 
            self.config(bg=self.origbkg)
 
        return "break"
0 comments (0 inline, 0 general)