changeset 52:065896b0913c

emergency commit
author dmcc
date Mon, 08 Jul 2002 03:25:42 +0000
parents 71489bb71528
children 032b2b67bc10
files Widgets/FlyingFader.py light8/ConfigDummy.py light8/Fader.py light8/panels.py light8/uihelpers.py
diffstat 5 files changed, 62 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Widgets/FlyingFader.py	Sun Jul 07 15:40:45 2002 +0000
+++ b/Widgets/FlyingFader.py	Mon Jul 08 03:25:42 2002 +0000
@@ -1,4 +1,4 @@
-from Tkinter import *
+from Tix import *
 from time import time,sleep
 from __future__ import division
 
@@ -152,7 +152,8 @@
         self.after(30, self.gofade)
 
     def updatelabel(self, *args):
-        self.vlabel['text'] = "%.3f" % self.variable.get()
+        if self.variable:
+            self.vlabel['text'] = "%.3f" % self.variable.get()
 #        if self.fadetimes[1] == 0: # no fade
 #            self.vlabel['fg'] = 'black'
 #        elif self.curfade[1] > self.curfade[0]:
@@ -166,7 +167,6 @@
     def set(self, val):
         self.scale.set(val)
 
-
 def colorfade(scale, lev):
     low = (255, 255, 255)
     high = (0, 0, 0)
--- a/light8/ConfigDummy.py	Sun Jul 07 15:40:45 2002 +0000
+++ b/light8/ConfigDummy.py	Mon Jul 08 03:25:42 2002 +0000
@@ -8,7 +8,7 @@
 f2 = Fade('green', 1, 3, 50)
 f3 = Fade('blue', 0, 4, 0)
 f4 = Fade('clear', 0, 8, 75) 
-c1 = Cue("Color shift", 0, 10, f1, f2, f3, f4)
+c1 = Cue("Color shift", 0, 10, None, f1, f2, f3, f4)
 
 cues = [c1]
 
--- a/light8/Fader.py	Sun Jul 07 15:40:45 2002 +0000
+++ b/light8/Fader.py	Mon Jul 08 03:25:42 2002 +0000
@@ -1,4 +1,12 @@
 from Tix import *
+from time import time # time is on my side
+from util import subsetdict
+
+# statuses are:
+# stopped - no cue is loaded
+# running - cue is running, not complete
+# halted - cue stops wherever it was, can't continue
+# finished - cue is finished, next is loaded
 
 stdfont = ('Arial', 10)
 
@@ -12,9 +20,19 @@
     def init_layout(self):
         Frame.__init__(self, self.master)
 
+        # info variables
         self.cuename = StringVar()
         self.cuelength = DoubleVar()
-        self.cueend = StringVar()
+        self.cuetarget = StringVar()
+
+        # info about a running cue
+        self.cuestatus = StringVar() # text description
+        self.cuestatus.set("stopped")
+        
+        self.cuepercent = DoubleVar() # percent complete
+        self.cuepercent.set(0)
+        self.cuetime = StringVar() # time left
+        self.cuetime.set('0 / 0')
 
         buttonframe = Frame(self)
 
@@ -30,25 +48,54 @@
         infoframe = Frame(self)
         Label(infoframe, textvariable=self.cuename, 
             font=('Arial', 12), bg='lightBlue').grid(columnspan=2, sticky=NE+SW)
+
         Label(infoframe, text="Length", font=stdfont, 
             bg='lightPink').grid(row=1, sticky=NE+SW)
         Label(infoframe, textvariable=self.cuelength, 
             font=stdfont).grid(row=1, column=1, sticky=NE+SW)
+
         Label(infoframe, text="Target", font=stdfont,
-            bg='lightPink').grid(row=2, sticky=NE+SW)
-        Label(infoframe, textvariable=self.cueend, 
+            bg='lightPink', wraplength=50).grid(row=2, sticky=NE+SW)
+        Label(infoframe, textvariable=self.cuetarget, 
             font=stdfont).grid(row=2, column=1, sticky=NE+SW)
+
+        Label(infoframe, text="Status", font=stdfont,
+            bg='lightPink').grid(row=3, sticky=NE+SW)
+        Label(infoframe, textvariable=self.cuestatus, 
+            font=stdfont).grid(row=3, column=1, sticky=NE+SW)
+
+        Label(infoframe, text="Time", font=stdfont,
+            bg='lightPink').grid(row=4, sticky=NE+SW)
+        Label(infoframe, textvariable=self.cuetime, 
+            font=stdfont).grid(row=4, column=1, sticky=NE+SW)
+
+        Label(infoframe, text="Percent Complete", font=stdfont,
+            bg='lightPink').grid(row=5, sticky=NE+SW)
+        Label(infoframe, textvariable=self.cuepercent, 
+            font=stdfont).grid(row=5, column=1, sticky=NE+SW)
+
         infoframe.pack(side=RIGHT, fill=BOTH, expand=1)
         buttonframe.pack(side=BOTTOM)
 
         self.listbox.listbox.select_set(0)
         self.update_selection()
     def update_selection(self):
-        print self.listbox.listbox.curselection()
         selection = int(self.listbox.listbox.curselection()[0]) # blech
         self.current = self.cues[selection]
         self.cuename.set(self.current.name)
         self.cuelength.set(self.current.dur)
-        self.cueend.set(str(self.current.get_end_levels()))
+        self.cuetarget.set(str(self.current.get_end_levels()))
     def go(self):
         print 'Fade to', self.current.name
+        self.cuestatus.set("running")
+        self.time_start = time()
+        startlevels = dict([(k, v.get()) for k, v in self.scalelevels.items()])
+        self.current.start(startlevels, self.time_start)
+        self.running_loop()
+    def running_loop(self):
+        curtime = time()
+        if (curtime - self.time_start) > self.current.dur:
+            return
+        newlevels = self.current.get_levels(time())
+        print newlevels
+        self.after(30, self.running_loop)
--- a/light8/panels.py	Sun Jul 07 15:40:45 2002 +0000
+++ b/light8/panels.py	Mon Jul 08 03:25:42 2002 +0000
@@ -157,8 +157,9 @@
 
             for axis in ('y','x'):
                 cvar=IntVar()
-                cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, padx=0, 
-                               pady=0, bd=1)
+                eb_color = ('red', 'green')[axis == 'y']
+                cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, 
+                                padx=0, pady=0, bd=1, downcolor=eb_color)
                 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)
--- a/light8/uihelpers.py	Sun Jul 07 15:40:45 2002 +0000
+++ b/light8/uihelpers.py	Mon Jul 08 03:25:42 2002 +0000
@@ -60,12 +60,13 @@
     label's on the button face, not to the side. the optional command
     callback is called on button set, not on unset. takes a variable
     just like a checkbutton"""
-    def __init__(self,parent,variable=None,command=None,**kw):
+    def __init__(self,parent,variable=None,command=None,downcolor='red',**kw):
 
         self.oldcommand = command
         Button.__init__(self,parent,command=self.invoke,**kw)
 
         self._origbkg = self.cget('bg')
+        self.downcolor = downcolor
 
         self._variable = variable
         if self._variable:
@@ -94,7 +95,7 @@
     def _setstate(self,newstate):
         self.state = newstate
         if newstate: # set
-            self.config(bg='red',relief='sunken')
+            self.config(bg=self.downcolor,relief='sunken')
         else: # unset
             self.config(bg=self._origbkg,relief='raised')
         return "break"