changeset 264:0f112a7dd6b3

fix window positoins for subcomposer and curvecalc. now saves geometry continuously
author drewp@bigasterisk.com
date Thu, 16 Jun 2005 22:33:27 +0000
parents 5da9139982c0
children 62e9761a5f13
files bin/curvecalc bin/keyboardcomposer light9/curve.py light9/uihelpers.py
diffstat 4 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bin/curvecalc	Thu Jun 16 22:32:29 2005 +0000
+++ b/bin/curvecalc	Thu Jun 16 22:33:27 2005 +0000
@@ -18,7 +18,8 @@
 from light9.TLUtility import make_attributes_from_args
 from light9.zoomcontrol import Zoomcontrol
 from light9.curve import Curve, Curveview, Curveset, Curvesetview
-from light9.wavelength import wavelength 
+from light9.wavelength import wavelength
+from light9.uihelpers import toplevelat
 
 class Music:
     def __init__(self):
@@ -222,7 +223,7 @@
 #######################################################################
 root=tk.Tk()
 root.tk_setPalette("gray50")
-root.wm_geometry("1120x850")
+toplevelat("curvecalc",root)
 root.tk_focusFollowsMouse()
 
 parser = optparse.OptionParser()
--- a/bin/keyboardcomposer	Thu Jun 16 22:32:29 2005 +0000
+++ b/bin/keyboardcomposer	Thu Jun 16 22:33:27 2005 +0000
@@ -257,6 +257,7 @@
 
     root = Tk()
     tl = toplevelat("Keyboard Composer", existingtoplevel=root)
+
     kc = KeyboardComposer(tl, s)
     kc.pack(fill=BOTH, expand=1)
 
@@ -266,5 +267,7 @@
     root.bind("<Destroy>",reactor.stop)
     root.protocol('WM_DELETE_WINDOW', reactor.stop)
     reactor.addSystemEventTrigger('after','shutdown',kc.save)
+
+    
     tksupport.install(root,ms=10)
     reactor.run()
--- a/light9/curve.py	Thu Jun 16 22:32:29 2005 +0000
+++ b/light9/curve.py	Thu Jun 16 22:33:27 2005 +0000
@@ -81,6 +81,8 @@
         self.bind("<Key-Escape>",lambda ev:
                   dispatcher.send("see time",
                                   t=self.current_time()))
+
+        # this binds on c-a-b1, etc
         RegionZoom(self, self.world_from_screen, self.screen_from_world)
 
     def current_time(self):
@@ -90,6 +92,7 @@
         start,end = self.zoom
         ht = self.winfo_height()
         return (p[0]-start)/(end-start)*self.winfo_width(), (ht-5)-p[1]*(ht-10)
+
     def world_from_screen(self,x,y):
         start,end = self.zoom
         ht = self.winfo_height()
--- a/light9/uihelpers.py	Thu Jun 16 22:32:29 2005 +0000
+++ b/light9/uihelpers.py	Thu Jun 16 22:33:27 2005 +0000
@@ -33,14 +33,10 @@
             f=open(".light9-window-geometry-%s" % name.replace(' ','_'),'w')
             f.write(tl.geometry())
         # else the window never got mapped
-    except:
+    except Exception, e:
         # it's ok if there's no saved geometry
         pass
 
-    # this would get called repeatedly for each child of the window (i
-    # dont know why) so we unbind after the first Destroy event
-    tl.unbind("<Destroy>",tl._toplevelat_funcid)
-
 def toplevelat(name, existingtoplevel=None):
     tl = existingtoplevel or Toplevel()
     tl.title(name)
@@ -55,7 +51,7 @@
     if name in windowlocations:
         tl.geometry(windowlocations[name])
 
-    tl._toplevelat_funcid=tl.bind("<Destroy>",lambda ev,tl=tl,name=name: toplevel_savegeometry(tl,name))
+    tl._toplevelat_funcid = tl.bind("<Configure>",lambda ev,tl=tl,name=name: toplevel_savegeometry(tl,name))
 
     return tl