diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -225,11 +225,13 @@ def sub_commands_tk(master, curveset, su def add_cmd(): add_one_subterm(newname.get(), curveset, subterms, root, ssv, '') + newname.set('') def reload_subs(): dispatcher.send('reload all subs') - tk.Button(f, text="reload subs", command=reload_subs).pack(side='left') + tk.Button(f, text="reload subs (C-r)", + command=reload_subs).pack(side='left') tk.Button(f,text="new subterm named:", command=add_cmd).pack(side='left') tk.Entry(f,textvariable=newname).pack(side='left',fill='x',exp=1) return f @@ -293,6 +295,7 @@ def savekey(*args): print "saved" root.bind("",savekey) +root.bind("", lambda evt: dispatcher.send('reload all subs')) create_status_lines(root) for helpline in ["Bindings: C-s save subterms; B1 drag point; C-B1 curve add point; 1..5 add point at time; Esc see current time; S-Esc see curtime to end; Mousewheel zoom; C-p play/pause music at mouse", diff --git a/light9/curve.py b/light9/curve.py --- a/light9/curve.py +++ b/light9/curve.py @@ -78,9 +78,12 @@ class Curveview(tk.Canvas): dispatcher.send("zoom about mouse", t=self.world_from_screen(ev.x,0)[0], factor=factor)) - self.bind("",lambda ev: + self.bind("", lambda ev: dispatcher.send("see time", t=self.current_time())) + self.bind("", lambda ev: + dispatcher.send("see time until end", + t=self.current_time())) self.bind("", lambda ev: dispatcher.send("music seek", t=self.world_from_screen(ev.x,0)[0])) diff --git a/light9/zoomcontrol.py b/light9/zoomcontrol.py --- a/light9/zoomcontrol.py +++ b/light9/zoomcontrol.py @@ -75,9 +75,10 @@ class Zoomcontrol(object,tk.Canvas): dispatcher.connect(lambda maxtime: (setattr(self,'maxtime',maxtime+15), self.redrawzoom()), "max time",weak=0) - dispatcher.connect(self.zoom_about_mouse,"zoom about mouse") - dispatcher.connect(self.see_time,"see time") - dispatcher.connect(self.zoom_to_range,"zoom to range") + dispatcher.connect(self.zoom_about_mouse, "zoom about mouse") + dispatcher.connect(self.see_time, "see time") + dispatcher.connect(self.see_time_until_end, "see time until end") + dispatcher.connect(self.zoom_to_range, "zoom to range") self.created=1 def zoom_to_range(self,start,end): self.start = start @@ -89,13 +90,19 @@ class Zoomcontrol(object,tk.Canvas): self.end = t + factor*(self.end-t) self.redrawzoom() - def see_time(self,t): + def see_time(self, t): vis_seconds = self.end - self.start margin = vis_seconds * .1 if t < self.start or t > (self.end - vis_seconds * .3): self.offset = t - margin self.redrawzoom() + + def see_time_until_end(self, t): + self.start = t - 2 + self.end = self.maxtime + + self.redrawzoom() def input_time(self,val): t=val