changeset 41:02151923be45

subediting is incorporated into rsn, and begins to work
author drewp
date Sun, 07 Jul 2002 12:18:06 +0000
parents f3d65ae17a8f
children 5e4fb4ac2d18
files light8/subediting.py
diffstat 1 files changed, 8 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/light8/subediting.py	Sun Jul 07 12:17:30 2002 +0000
+++ b/light8/subediting.py	Sun Jul 07 12:18:06 2002 +0000
@@ -10,28 +10,12 @@
     20:41:37 drewp: if you drag a light that's in the sub you're editing, you'll adjust it from it's position in the sub (Even if that sub is not visialbe, or if the light is doing someting else)
     20:41:57 drewp: but if you touch a light that wasnt in the sub, the current light brightness from the stage gets copied into the sub, and then you adjust frmo there
     20:42:05 drewp: i dont know any other rules; but these seem odd
-    20:42:29 drewp: it may be necessary to highluight which lights are already in the sub, so you know what you're doing as soon as you click on one
+    20:42:29 drewp: it may be necessary to highlight which lights are already in the sub, so you know what you're doing as soon as you click on one
     """
     def __init__(self,currentoutputlevels):
         self.sub=None
         self.currentoutputlevels = currentoutputlevels
-        self.widgets={} # subname : widget list
-        self.oldcolors={} # widget : bgcolor
 
-    def refresh(self):
-        self.sub=None # this wouldn't last even if we wanted it to;
-        # the Sub objects are rebuilt upon reload
-        self.widgets={}
-        self.oldcolors={}
-
-    def register(self,subname,widget):
-        """tell subediting about any widgets that should be highlighted
-        when a sub is being edited"""
-        if subname not in self.widgets:
-            self.widgets[subname]=[]
-        self.widgets[subname].append(widget)
-        self.oldcolors[widget] = widget.cget('bg')
-    
     def setsub(self,sub):
         """sets which (one) sub object should the stage be editing.
 
@@ -40,41 +24,12 @@
         
         print "subedit: editing ",sub.name
         self.sub = sub
-        self.highlighteditsub()
-    def highlighteditsub(self, color='red'):
-        """based on how widgets got self.register'd, we highlight
-        just the row that's being edited"""
 
-        # highlight that row only
-        for n,wl in self.widgets.items():
-            if n == self.sub.name:
-                self.colorsub(n, color)
-            else:
-                self.colorsub(n, 'restore')
-
-        '''
-        # highlight that row only
-        for n,wl in self.widgets.items():
-            if n==self.sub.name:
-                for w in wl:
-                    w.config(bg=color)
-            else:
-                for w in wl:
-                    w.config(bg=self.oldcolors[w])
-        '''
-    def colorsub(self, name, color):
-        for w in self.widgets[name]:
-            if color == 'restore':
-                w.config(bg=self.oldcolors[w])
-            else:
-                w.config(bg=color)
-        
     #
     # next two methods are called by the Stage
     #
     def startlevelchange(self):
-        """stage is about to send some level changes. this method is
-        called by the Stage."""
+        "stage is about to send some level changes. this method is called by the Stage."
         print "subedit: start-------"
         if self.sub is None:
             print "not editing any sub!"
@@ -83,10 +38,13 @@
         self.startlevels = self.sub.getlevels()
 
     def getcurrentlevel(self,lightname):
+        print "resolve",lightname
+        ch = get_dmx_channel(lightname)
         try:
             ch = get_dmx_channel(lightname)
         except ValueError:
             return None
+        print "resolved ch",ch
         return self.currentoutputlevels[ch]
 
     def levelchange(self,lightnames,delta):
@@ -94,7 +52,7 @@
         0..1 measured from the last startlevelchange call. this method is
         called by the Stage"""
 
-#        print "subedit: level change",lightnames,delta
+        print "subedit: level change",lightnames,delta
         if self.sub is None:
             print "not editing any sub!"
             return
@@ -106,8 +64,8 @@
                 # level was not in the sub
                 cl = self.getcurrentlevel(l)
                 if cl is None:
-                    print "light '%s' isn't even in the patch! skipping" % l
-                    continue
+                    print "light isn't even in the patch! skipping"
+                    return
                 print "copying current light level",cl,"into the sub"
                 self.startlevels[l] = cl