Changeset - 0f112a7dd6b3
[Not reviewed]
default
0 4 0
drewp@bigasterisk.com - 20 years ago 2005-06-16 22:33:27
drewp@bigasterisk.com
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
4 files changed with 11 insertions and 8 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -15,13 +15,14 @@ from twisted.web.xmlrpc import Proxy
 

	
 
import run_local
 
from light9 import Submaster, dmxclient, networking, showconfig
 
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):
 
        self.player=None # xmlrpc Proxy to player
 
        self.recenttime=0
 
        
 
@@ -219,13 +220,13 @@ def subterm_adder(master, curveset, subt
 
    tk.Entry(f,textvariable=newname).pack(side='left',fill='x',exp=1)
 
    return f
 
    
 
#######################################################################
 
root=tk.Tk()
 
root.tk_setPalette("gray50")
 
root.wm_geometry("1120x850")
 
toplevelat("curvecalc",root)
 
root.tk_focusFollowsMouse()
 

	
 
parser = optparse.OptionParser()
 
options,args = parser.parse_args()
 

	
 
try:
bin/keyboardcomposer
Show inline comments
 
@@ -254,17 +254,20 @@ class LevelServer(xmlrpc.XMLRPC):
 

	
 
if __name__ == "__main__":
 
    s = Submasters()
 

	
 
    root = Tk()
 
    tl = toplevelat("Keyboard Composer", existingtoplevel=root)
 

	
 
    kc = KeyboardComposer(tl, s)
 
    kc.pack(fill=BOTH, expand=1)
 

	
 
    ls = LevelServer(kc.name_to_subtk)
 
    reactor.listenTCP(8050, server.Site(ls))
 

	
 
    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()
light9/curve.py
Show inline comments
 
@@ -78,21 +78,24 @@ class Curveview(tk.Canvas):
 
                      dispatcher.send("zoom about mouse",
 
                                      t=self.world_from_screen(ev.x,0)[0],
 
                                      factor=factor))
 
        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):
 
        return self._time
 

	
 
    def screen_from_world(self,p):
 
        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()
 
        return x/self.winfo_width()*(end-start)+start, ((ht-5)-y)/(ht-10)
 
    
 
    def input_time(self,val):
light9/uihelpers.py
Show inline comments
 
@@ -30,20 +30,16 @@ def toplevel_savegeometry(tl,name):
 
    try:
 
        geo = tl.geometry()
 
        if not geo.startswith("1x1"):
 
            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)
 

	
 
    try:
 
        f=open(".light9-window-geometry-%s" % name.replace(' ','_'))
 
@@ -52,13 +48,13 @@ def toplevelat(name, existingtoplevel=No
 
        # it's ok if there's no saved geometry
 
        pass
 

	
 
    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
 

	
 
def toggle_slider(s):
 
    if s.get() == 0:
 
        s.set(100)
0 comments (0 inline, 0 general)