changeset 695:0b8fc64a896c

goocanvas drawing a little Ignore-this: aae191151f454a98caa671b65d080029
author Drew Perttula <drewp@bigasterisk.com>
date Fri, 08 Jun 2012 07:54:32 +0000
parents 34dacd800505
children 929ccd4ec800
files bin/curvecalc light9/curvecalc/curvecalc.glade light9/curvecalc/curveview.py
diffstat 3 files changed, 37 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/bin/curvecalc	Fri Jun 08 07:38:46 2012 +0000
+++ b/bin/curvecalc	Fri Jun 08 07:54:32 2012 +0000
@@ -57,7 +57,6 @@
 
         mainwin.connect("delete-event", lambda *args: reactor.crash())
         mainwin.set_title("curvecalc - %s" % graph.label(song))
-        mainwin.parse_geometry("1000x1000")
         
         self.add_subterms_for_song(song, curveset, subterms,
                                    wtree.get_object("subterms")
@@ -65,7 +64,8 @@
 
 
         curvesetView = Curvesetview(wtree.get_object("curves"), curveset)
-
+        self.curvesetView = curvesetView # mem problem; don't let this get lost
+        
         # curvesetview must already exist, since this makes 'add_curve'
         # signals for all the initial curves
         curveset.load(basename=os.path.join(
--- a/light9/curvecalc/curvecalc.glade	Fri Jun 08 07:38:46 2012 +0000
+++ b/light9/curvecalc/curvecalc.glade	Fri Jun 08 07:54:32 2012 +0000
@@ -2,8 +2,6 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkWindow" id="MainWindow">
-    <property name="width_request">530</property>
-    <property name="height_request">380</property>
     <property name="can_focus">False</property>
     <child>
       <object class="GtkVBox" id="vbox1">
@@ -210,11 +208,12 @@
         </child>
         <child>
           <object class="GtkVPaned" id="paned1">
-            <property name="height_request">200</property>
+            <property name="height_request">600</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <child>
               <object class="GtkExpander" id="expander2">
+                <property name="height_request">400</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="expanded">True</property>
@@ -311,6 +310,7 @@
             </child>
             <child>
               <object class="GtkExpander" id="expander1">
+                <property name="height_request">120</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="expanded">True</property>
@@ -371,6 +371,12 @@
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </object>
                             </child>
                           </object>
@@ -490,6 +496,12 @@
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                 </child>
                 <child type="label">
--- a/light9/curvecalc/curveview.py	Fri Jun 08 07:38:46 2012 +0000
+++ b/light9/curvecalc/curveview.py	Fri Jun 08 07:54:32 2012 +0000
@@ -75,6 +75,8 @@
         """knobEnabled=True highlights the previous key and ties it to a
         hardware knob"""
         self.widget = goocanvas.Canvas()
+        self.widget.set_property("background-color", "black")
+        self.widget.set_size_request(-1, 130)
         self.root = self.widget.get_root_item()
 
         self.redrawsEnabled = False
@@ -95,7 +97,7 @@
         if self.knobEnabled:
             dispatcher.connect(self.knob_in, "knob in")
             dispatcher.connect(self.slider_in, "set key")
-        print "setup alloc", self.__dict__
+
         self.widget.connect("size-allocate", self.update_curve)
         if 0:
 
@@ -283,8 +285,7 @@
                 dispatcher.send("knob out", value=prevKey[1], curve=self.curve)
         
     def update_curve(self, _widget=None, _rect=None):
-        print "update curve on", self, id(self), self.__dict__
-        if not getattr(self, 'redrawsEnabled', False):
+        if not self.redrawsEnabled:
             return
         self.size = self.widget.get_allocation()
 
@@ -358,10 +359,9 @@
                               fill=color, width=0, tags='curve')        
 
     def _draw_markers(self,visible_x):
-        return
         mark = self._draw_one_marker
 
-        mark(0,"0")
+        mark(0, "0")
         t1,t2=visible_x
         if t2-t1<30:
             for t in range(int(t1),int(t2)+1):
@@ -371,7 +371,7 @@
         endtimes = dispatcher.send("get max time")
         if endtimes:
             endtime = endtimes[0][1]
-            mark(endtime,"end %.1f"%endtime)
+            mark(endtime, "end %.1f"%endtime)
             mark(endtime - postPad, "post %.1f" % (endtime - postPad))
         
     def _draw_one_marker(self,t,label):
@@ -380,12 +380,14 @@
         if not 0 <= x < self.size.width:
             return
         x = max(5, x) # cheat left-edge stuff onscreen
-        self.create_line(x, ht,
-                         x, ht - 20,
-                         fill='white', tags=('curve',))
-        self.create_text(x, ht-20, text=label, anchor='s', fill='white',
-                         font="arial 7", tags=('curve',))
-
+        goocanvas.polyline_new_line(self.curveGroup,
+                                    x, ht,
+                                    x, ht - 20,
+                                    stroke_color='white')
+        goocanvas.Text(parent=self.curveGroup,
+                       fill_color="white",
+                       x=x, y=ht-20,
+                       text=label)
 
     def _draw_line(self,visible_points):
         linepts=[]
@@ -404,11 +406,11 @@
         else:
             fill = 'white'
 
-        goocanvas.Polyline(parent=self.curveGroup,
-                           points=goocanvas.Points(linepts),
-                           width=linewidth,
-                           stroke_color=fill,
-                           )
+        self.pl = goocanvas.Polyline(parent=self.curveGroup,
+                                     points=goocanvas.Points(linepts),
+                                     width=linewidth,
+                                     stroke_color=fill,
+                                     )
             
         # canvas doesnt have keyboard focus, so i can't easily change the
         # cursor when ctrl is pressed
@@ -697,7 +699,7 @@
         self.curvesVBox.pack_end(f.box)
         f.box.show_all()
         self.allCurveRows.add(f)
-        f.curveView.goLive()
+        #f.curveView.goLive()
 
 
     def goLive(self):