changeset 281:e3362ad9a123

curvecalc gets "see time until end", C-r for reload, doc updates
author David McClosky <dmcc@bigasterisk.com>
date Fri, 17 Jun 2005 20:21:31 +0000
parents 6cde24055a67
children d482699decbd
files bin/curvecalc light9/curve.py light9/zoomcontrol.py
diffstat 3 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bin/curvecalc	Fri Jun 17 20:06:19 2005 +0000
+++ b/bin/curvecalc	Fri Jun 17 20:21:31 2005 +0000
@@ -225,11 +225,13 @@
 
     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 @@
     print "saved"
     
 root.bind("<Control-Key-s>",savekey)
+root.bind("<Control-Key-r>", 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",
--- a/light9/curve.py	Fri Jun 17 20:06:19 2005 +0000
+++ b/light9/curve.py	Fri Jun 17 20:21:31 2005 +0000
@@ -78,9 +78,12 @@
                       dispatcher.send("zoom about mouse",
                                       t=self.world_from_screen(ev.x,0)[0],
                                       factor=factor))
-        self.bind("<Key-Escape>",lambda ev:
+        self.bind("<Key-Escape>", lambda ev:
                   dispatcher.send("see time",
                                   t=self.current_time()))
+        self.bind("<Shift-Escape>", lambda ev:
+                  dispatcher.send("see time until end",
+                                  t=self.current_time()))
         self.bind("<Control-p>", lambda ev:
                   dispatcher.send("music seek",
                                   t=self.world_from_screen(ev.x,0)[0]))
--- a/light9/zoomcontrol.py	Fri Jun 17 20:06:19 2005 +0000
+++ b/light9/zoomcontrol.py	Fri Jun 17 20:21:31 2005 +0000
@@ -75,9 +75,10 @@
         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 @@
         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