Mercurial > code > home > repos > light9
diff bin/curvecalc @ 476:0e3743492eae
curvecalc: new keyboard shortcut hotness
author | drewp@bigasterisk.com |
---|---|
date | Fri, 12 Jun 2009 22:46:17 +0000 |
parents | 9ed6c40b3d6a |
children | b8012dcb714b |
line wrap: on
line diff
--- a/bin/curvecalc Fri Jun 12 10:45:57 2009 +0000 +++ b/bin/curvecalc Fri Jun 12 22:46:17 2009 +0000 @@ -342,11 +342,16 @@ tk.Button(f, text="reload subs (C-r)", command=reload_subs).pack(side='left') - tk.Label(f, text="new subterm named (C-Enter for curve too):").pack(side='left') + tk.Label(f, text="new subterm named (C-Enter for curve too, C-n for focus):").pack(side='left') entry = tk.Entry(f, textvariable=newname) entry.pack(side='left', fill='x', exp=1) entry.bind("<Key-Return>", add_cmd) + def focus_entry(): + entry.focus() + + dispatcher.connect(focus_entry, "focus new subterm", weak=False) + return f def savesubterms(filename,subterms): @@ -464,6 +469,8 @@ root.bind("<Control-Key-s>",savekey) root.bind("<Control-Key-r>", lambda evt: dispatcher.send('reload all subs')) +root.bind("<Control-Key-n>", lambda evt: dispatcher.send('focus new subterm')) +root.bind("<Control-Key-N>", lambda evt: dispatcher.send('focus new curve')) create_status_lines(root) for helpline in ["Bindings: C-s save subterms; Esc see current time; S-Esc see curtime to end; C-Esc show all; Mousewheel zoom; C-p play/pause music at mouse",