Changeset - 411de8b46aef
[Not reviewed]
default
0 3 0
dmcc - 22 years ago 2002-07-07 12:06:16

the famous you-are-in-the-process-of-changing-this-light indicator.
the famous you-are-in-the-process-of-changing-this-light indicator.
red = going up
blue = going down

also, a generic color fader in uihelpers.py -- unused (as of now)
3 files changed with 26 insertions and 5 deletions:
0 comments (0 inline, 0 general)
light8/panels.py
Show inline comments
 
@@ -47,7 +47,7 @@ class Leveldisplay:
 
    def __init__(self, parent, channel_levels, num_channels=68):
 
        frames = (make_frame(parent), make_frame(parent))
 
        channel_levels[:]=[]
 
        self.number_labels = {}
 
        self.number_labels = []
 
        for channel in range(1, num_channels+1):
 

	
 
            # frame for this channel
 
@@ -56,7 +56,7 @@ class Leveldisplay:
 
            num_lab = Label(f, text=str(channel), width=3, bg='lightPink', 
 
                font=stdfont, padx=0, pady=0, bd=0, height=1)
 
            num_lab.pack(side='left')
 
            self.number_labels[channel] = num_lab
 
            self.number_labels.append(num_lab)
 

	
 
            # text description of channel
 
            Label(f, text=Patch.get_channel_name(channel), width=8, 
light8/rsn.py
Show inline comments
 
@@ -4,7 +4,7 @@ from __future__ import nested_scopes
 
from Tkinter import *
 
from time import sleep
 
from signal import *
 
import sys, thread, cPickle
 
import sys, thread, cPickle, math
 

	
 
import io
 
from uihelpers import *
 
@@ -69,7 +69,7 @@ class Lightboard:
 
        leveldisplay_tl = toplevelat(873,400)
 
        leveldisplay_tl.bind('<Escape>', sys.exit)
 

	
 
        leveldisplay = Leveldisplay(leveldisplay_tl, self.channel_levels)
 
        self.leveldisplay = Leveldisplay(leveldisplay_tl, self.channel_levels)
 

	
 
        Console()
 

	
 
@@ -105,10 +105,18 @@ class Lightboard:
 

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

	
 
        for lev,lab,oldlev in zip(levels, self.channel_levels, self.oldlevels):
 
        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)
 
                colorlabel(lab)
 
                if lev < oldlev:
 
                    numlab['bg'] = 'red'
 
                else:
 
                    numlab['bg'] = 'blue'
 
            else:
 
                numlab['bg'] = 'lightPink'
 

	
 
        self.oldlevels = levels[:]
 
            
light8/uihelpers.py
Show inline comments
 
"""all the tiny tk helper functions"""
 

	
 
from Tkinter import *
 
from types import StringType
 

	
 
def make_frame(parent):
 
    f = Frame(parent, bd=0)
 
@@ -40,6 +41,18 @@ def colorlabel(label):
 
    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)
 
    return col
 

	
 
def colortotuple(anytkobj, colorname):
 
    'pass any tk object and a color name, like "yellow"'
 
    rgb = anytkobj.winfo_rgb(colorname)
 
    return [v / 256 for v in rgb]
 

	
 
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):
0 comments (0 inline, 0 general)