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
 
@@ -44,22 +44,22 @@ class Console:
 
        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 = {}
 
        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.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, 
 
                font=stdfont, anchor='w', padx=0, pady=0, bd=0, 
 
                height=1).pack(side='left')
 

	
light8/rsn.py
Show inline comments
 
#!/usr/bin/env python
 
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 *
 
from panels import *
 
from Xfader import *
 
import stage
 
@@ -66,13 +66,13 @@ class Lightboard:
 
        self.subpanels = Subpanels(sub_tl, effect_tl, self.scalelevels, Subs, 
 
            self.xfader, self.changelevel)
 

	
 
        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()
 

	
 
        # root frame
 
        controlpanel = Controlpanel(root, self.xfader, self.refresh, self.quit)
 
        
 
@@ -102,16 +102,24 @@ class Lightboard:
 
            newlevels = s.get_levels(level=self.scalelevels[name].get())
 
            for (ch, fadelev) in newlevels.items():
 
                levels[ch-1] = max(levels[ch-1], fadelev)
 

	
 
        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[:]
 
            
 
        parportdmx.sendlevels(levels)
 

	
 
    def load(self):
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)
 
    f.pack(side='left')
 
    return f
 

	
 
@@ -37,12 +38,24 @@ def colorlabel(label):
 
    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)
 
    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):
 
        if kw['variable']:
 
            self.variable = kw['variable']
 
            self.variable.trace('w',self.varchanged)
0 comments (0 inline, 0 general)