changeset 545:b05423b17c46

remove curvecalc's old intro/post cheats, replace with slightly better ones Ignore-this: abdfdba8eedd6e050f88d3f4b0d82efc
author drewp@bigasterisk.com
date Tue, 15 Jun 2010 05:38:24 +0000
parents 3cfe10787c56
children f5b01841587f
files light9/curve.py light9/zoomcontrol.py
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/light9/curve.py	Tue Jun 15 04:13:50 2010 +0000
+++ b/light9/curve.py	Tue Jun 15 05:38:24 2010 +0000
@@ -13,6 +13,10 @@
 from light9.zoomcontrol import RegionZoom
 from bcf2000 import BCF2000
 
+# todo: move to config, consolidate with ascoltami, musicPad, etc
+introPad = 4
+postPad = 4
+
 class Curve(object):
     """curve does not know its name. see Curveset"""
     points = None # x-sorted list of (x,y)
@@ -418,20 +422,24 @@
         if t2-t1<30:
             for t in range(int(t1),int(t2)+1):
                 mark(t,str(t))
-        mark(-4,"-4")
+        mark(introPad, str(introPad))
 
         endtimes = dispatcher.send("get max time")
         if endtimes:
             endtime = endtimes[0][1]
             mark(endtime,"end %.1f"%endtime)
-            mark(endtime+10,"post %.1f"%(endtime+10))
+            mark(endtime - postPad, "post %.1f" % (endtime - postPad))
         
     def _draw_one_marker(self,t,label):
         x = self.screen_from_world((t,0))[0]
         ht = self.height
-        self.create_line(x,ht,x,ht-20, fill='white',
-                         tags=('curve',))
-        self.create_text(x,ht-20,text=label,anchor='s', fill='white',
+        if not 0 <= x < self.winfo_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',))
 
 
@@ -682,7 +690,7 @@
         return self.curves.copy()
     
     def get_time_range(self):
-        return -4, dispatcher.send("get max time")[0][1]+15
+        return 0, dispatcher.send("get max time")[0][1]
 
     def new_curve(self,name):
         if name=="":
--- a/light9/zoomcontrol.py	Tue Jun 15 04:13:50 2010 +0000
+++ b/light9/zoomcontrol.py	Tue Jun 15 05:38:24 2010 +0000
@@ -8,7 +8,7 @@
 
 class Zoomcontrol(object,tk.Canvas):
 
-    mintime=-5
+    mintime = 0
 
     def maxtime():
         doc = "seconds at the right edge of the bar"
@@ -75,7 +75,7 @@
         
         dispatcher.connect(lambda: (self.start,self.end),"zoom area",weak=0)
         dispatcher.connect(self.input_time,"input time")
-        dispatcher.connect(lambda maxtime: (setattr(self,'maxtime',maxtime+15),
+        dispatcher.connect(lambda maxtime: (setattr(self,'maxtime',maxtime),
                                             self.redrawzoom()),
                            "max time",weak=0)
         dispatcher.connect(self.zoom_about_mouse, "zoom about mouse")
@@ -167,7 +167,7 @@
         lastx=-1000
         for t in range(0,int(self.maxtime)):
             x = self.can_for_t(t)
-            if 0<x<self.winfo_width() and x-lastx>30:
+            if 0 < x < self.winfo_width() and x-lastx>30:
                 txt=str(t)
                 if lastx==-1000:
                     txt=txt+"sec"