Mercurial > code > home > repos > light9
changeset 267:9de7bbf50267
curvecalc fixes, especially a slowdown of the updates that's working better
author | drewp@bigasterisk.com |
---|---|
date | Fri, 17 Jun 2005 03:49:07 +0000 |
parents | 58bbf9f42457 |
children | d5858e9fa689 |
files | bin/curvecalc light9/curve.py |
diffstat | 2 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/curvecalc Fri Jun 17 00:52:22 2005 +0000 +++ b/bin/curvecalc Fri Jun 17 03:49:07 2005 +0000 @@ -300,9 +300,10 @@ def update2(t): global recent_t,later dispatcher.send("update status", - val="ok: receiving times from music player") + val="ok: receiving time from music player") if later and not later.cancelled and not later.called: later.cancel() - later = reactor.callLater(.01,update) + + later = reactor.callLater(.05,update) recent_t = recent_t[-50:]+[t] period = (recent_t[-1]-recent_t[0])/len(recent_t) @@ -317,9 +318,9 @@ root.bind("<Control-Key-q>",lambda ev: reactor.stop) root.bind("<Destroy>",lambda ev: reactor.stop) root.protocol('WM_DELETE_WINDOW', reactor.stop) -tksupport.install(root,ms=10) +tksupport.install(root,ms=20) if 0: - sys.path.append("/home/drewp/projects/editor/pour") + sys.path.append("/home/drewp/projects/cuisine/pour") from utils import runstats runstats("reactor.run()") else:
--- a/light9/curve.py Fri Jun 17 00:52:22 2005 +0000 +++ b/light9/curve.py Fri Jun 17 03:49:07 2005 +0000 @@ -58,12 +58,12 @@ relief='sunken',bd=1, closeenough=5,takefocus=1, **kw) self.selected_points=[] # idx of points being dragged - self.update() + self.update_curve() # self.bind("<Enter>",self.focus) dispatcher.connect(self.input_time,"input time") - dispatcher.connect(self.update,"zoom changed") - dispatcher.connect(self.update,"points changed",sender=self.curve) - self.bind("<Configure>",self.update) + dispatcher.connect(self.update_curve,"zoom changed") + dispatcher.connect(self.update_curve,"points changed",sender=self.curve) + self.bind("<Configure>",self.update_curve) for x in range(1, 6): def add_kb_marker_point(evt, x=x): print "add_kb_marker_point", evt @@ -104,7 +104,7 @@ self.delete('timecursor') self.create_line(*pts,**dict(width=2,fill='red',tags=('timecursor',))) self._time = t - def update(self,*args): + def update_curve(self,*args): self.zoom = dispatcher.send("zoom area")[0][1] cp = self.curve.points @@ -160,9 +160,10 @@ def _draw_one_marker(self,t,label): x = self.screen_from_world((t,0))[0] - self.create_line(x,self.winfo_height(),x,self.winfo_height()-20, + ht = self.winfo_height() + self.create_line(x,ht,x,ht-20, tags=('curve',)) - self.create_text(x,self.winfo_height()-20,text=label,anchor='s', + self.create_text(x,ht-20,text=label,anchor='s', tags=('curve',)) @@ -224,7 +225,7 @@ def add_point(self, p): self.unselect() self.curve.insert_pt(p) - self.update() + self.update_curve() def highlight_selected_dots(self): for i,d in self.dots.items(): @@ -250,7 +251,7 @@ moved=1 cp[idx] = (x,y) if moved: - self.update() + self.update_curve() def unselect(self): self.selected_points=[] self.highlight_selected_dots()