# HG changeset patch # User drewp@bigasterisk.com # Date 2005-06-16 22:33:27 # Node ID 0f112a7dd6b3d9adfbd74a74ffa08db39c5b95d4 # Parent 5da9139982c03704bef67b449bf4db022352745e fix window positoins for subcomposer and curvecalc. now saves geometry continuously diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -18,7 +18,8 @@ from light9 import Submaster, dmxclient, 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 @@ def subterm_adder(master, curveset, subt ####################################################################### root=tk.Tk() root.tk_setPalette("gray50") -root.wm_geometry("1120x850") +toplevelat("curvecalc",root) root.tk_focusFollowsMouse() parser = optparse.OptionParser() diff --git a/bin/keyboardcomposer b/bin/keyboardcomposer --- a/bin/keyboardcomposer +++ b/bin/keyboardcomposer @@ -257,6 +257,7 @@ if __name__ == "__main__": root = Tk() tl = toplevelat("Keyboard Composer", existingtoplevel=root) + kc = KeyboardComposer(tl, s) kc.pack(fill=BOTH, expand=1) @@ -266,5 +267,7 @@ if __name__ == "__main__": root.bind("",reactor.stop) root.protocol('WM_DELETE_WINDOW', reactor.stop) reactor.addSystemEventTrigger('after','shutdown',kc.save) + + tksupport.install(root,ms=10) reactor.run() diff --git a/light9/curve.py b/light9/curve.py --- a/light9/curve.py +++ b/light9/curve.py @@ -81,6 +81,8 @@ class Curveview(tk.Canvas): self.bind("",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 @@ class Curveview(tk.Canvas): 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() diff --git a/light9/uihelpers.py b/light9/uihelpers.py --- a/light9/uihelpers.py +++ b/light9/uihelpers.py @@ -33,14 +33,10 @@ def toplevel_savegeometry(tl,name): 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("",tl._toplevelat_funcid) - def toplevelat(name, existingtoplevel=None): tl = existingtoplevel or Toplevel() tl.title(name) @@ -55,7 +51,7 @@ def toplevelat(name, existingtoplevel=No if name in windowlocations: tl.geometry(windowlocations[name]) - tl._toplevelat_funcid=tl.bind("",lambda ev,tl=tl,name=name: toplevel_savegeometry(tl,name)) + tl._toplevelat_funcid = tl.bind("",lambda ev,tl=tl,name=name: toplevel_savegeometry(tl,name)) return tl