Ejemplo n.º 1
0
    def __init__(self, parent, channelnum):
        """channelnum is 1..68, like the real dmx"""
        tk.Frame.__init__(self,parent, height=20)

        self.channelnum=channelnum
        self.currentlevel=0 # the level we're displaying, 0..1
        
        # 3 widgets, left-to-right:

        # channel number -- will turn yellow when being altered
        self.num_lab = tk.Label(self, text=str(channelnum),
                                width=3, bg='grey40', 
                                fg='white',
                                font=stdfont,
                                padx=0, pady=0, bd=0, height=1)
        self.num_lab.pack(side='left')

        # text description of channel
        self.desc_lab=tk.Label(self, text=Patch.get_channel_name(channelnum),
                               width=14,
                               font=stdfont,
                               anchor='w',
                               padx=0, pady=0, bd=0, 
                 height=1, bg='black', fg='white')
        self.desc_lab.pack(side='left')

        # current level of channel, shows intensity with color
        self.level_lab = tk.Label(self, width=3, bg='lightBlue',
                                  anchor='e', 
                                  padx=1, pady=0, bd=0, height=1)
        self.level_lab.pack(side='left')
        # setting the font in the label somehow makes tk run a low
        # slower. Magically, startup is much faster if tk can layout
        # the window with some standard font in the rows (so the row
        # heights are all fixed and taller?), and then I replace the
        # last font. Tk resizes the window faster than you can see,
        # but startup is still fast. Very weird.
        self.after(1, lambda: self.level_lab.config(font=stdfont))

        self.setlevel(0)
        self.setupmousebindings()
Ejemplo n.º 2
0
def chase(t, ontime=0.5, offset=0.2, onval=1.0, 
          offval=0.0, names=None, combiner=max, random=False):
    """names is list of URIs. returns a submaster that chases through
    the inputs"""
    if random:
        r = random_mod.Random(random)
        names = names[:]
        r.shuffle(names)

    chase_vals = chase_logic(t, ontime, offset, onval, offval, names, combiner)
    lev = {}
    for uri, value in chase_vals.items():
        try:
            dmx = Patch.dmx_from_uri(uri)
        except KeyError:
            log.info(("chase includes %r, which doesn't resolve to a dmx chan" %
                   uri))
            continue
        lev[dmx] = value

    return Submaster.Submaster(name="chase" ,levels=lev)
Ejemplo n.º 3
0
def stack(t, names=None, fade=0):
    """names is list of URIs. returns a submaster that stacks the the inputs

    fade=0 makes steps, fade=1 means each one gets its full fraction
    of the time to fade in. Fades never...
    """
    frac = 1.0 / len(names)

    lev = {}
    for i, uri in enumerate(names):
        if t >= (i + 1) * frac:
            try:
                dmx = Patch.dmx_from_uri(uri)
            except KeyError:
                log.info(("stack includes %r, which doesn't resolve to a dmx chan"%
                       uri))
                continue
            lev[dmx] = 1
        else:
            break
    
    return Submaster.Submaster(name="stack", levels=lev)
Ejemplo n.º 4
0
 def chan(name):
     return Submaster.Submaster(
         leveldict={Patch.get_dmx_channel(name) : 1.0},
         temporary=True)
Ejemplo n.º 5
0
def test():
    assert Patch.get_channel_name(1) == "frontLeft"
    assert Patch.get_channel_name("1") == "frontLeft"
    assert Patch.get_channel_name("frontLeft") == "frontLeft"
    
    assert Patch.get_dmx_channel(1) == 1
    assert Patch.get_dmx_channel("1") == 1
    assert Patch.get_dmx_channel("frontLeft") == 1
    
    assert Patch.get_channel_name("b1") == "frontLeft"
    assert Patch.get_dmx_channel("b1") == 1
    assert Patch.resolve_name("b1") == "frontLeft"
    assert Patch.resolve_name("frontLeft") == "frontLeft"

    assert Patch.get_channel_uri("frontLeft") == L9['theater/skyline/channel/frontLeft']