# HG changeset patch # User drewp@bigasterisk.com # Date 2010-06-15 05:38:24 # Node ID b05423b17c4664b70e8eac75c46159948e239ae9 # Parent 3cfe10787c5696a48ff579236d9d0af0eff50ad7 remove curvecalc's old intro/post cheats, replace with slightly better ones Ignore-this: abdfdba8eedd6e050f88d3f4b0d82efc diff --git a/light9/curve.py b/light9/curve.py --- a/light9/curve.py +++ b/light9/curve.py @@ -13,6 +13,10 @@ from light9.dmxchanedit import gradient 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 @@ class Curveview(tk.Canvas): 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 @@ class Curveset: 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=="": diff --git a/light9/zoomcontrol.py b/light9/zoomcontrol.py --- a/light9/zoomcontrol.py +++ b/light9/zoomcontrol.py @@ -8,7 +8,7 @@ from light9 import cursors class Zoomcontrol(object,tk.Canvas): - mintime=-5 + mintime = 0 def maxtime(): doc = "seconds at the right edge of the bar" @@ -75,7 +75,7 @@ class Zoomcontrol(object,tk.Canvas): 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 @@ class Zoomcontrol(object,tk.Canvas): lastx=-1000 for t in range(0,int(self.maxtime)): x = self.can_for_t(t) - if 030: + if 0 < x < self.winfo_width() and x-lastx>30: txt=str(t) if lastx==-1000: txt=txt+"sec"