diff --git a/twander.py b/twander.py index 0ce8fca..2f75aed 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.90 2003/02/03 22:46:07 tundra Exp $" +RCSID = "$Id: twander.py,v 2.91 2003/02/04 18:53:18 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -128,6 +128,21 @@ SELKEY = '' # Select item w/keyboard MOUSESEL = '' # Select item w/mouse +# Directory Shortcuts + +KDIRSC1 = '' +KDIRSC2 = '' +KDIRSC3 = '' +KDIRSC4 = '' +KDIRSC5 = '' +KDIRSC6 = '' +KDIRSC7 = '' +KDIRSC8 = '' +KDIRSC9 = '' +KDIRSC10 = '' +KDIRSC11 = '' +KDIRSC12 = '' + # Program Memories MEMCLR1 = '' @@ -158,6 +173,7 @@ MEMSET11 = '' MEMSET12 = '' + ##### # GUI Defaults ##### @@ -734,11 +750,11 @@ global CONF, UI # Cleanout any old configuration data - UI.CmdTable = {} - UI.FuncKeys = ["", "", "", "", "", "", + UI.CmdTable = {} + UI.DirSCKeys = ["", "", "", "", "", "", "", "", "", "", "", ""] - UI.SymTable = {} - linenum = 0 + UI.SymTable = {} + linenum = 0 # Unbind all existing key bindings for x in UI.KeyBindings.keys(): @@ -782,6 +798,18 @@ "RUNCMD":RUNCMD, "SELKEY":SELKEY, "MOUSESEL":MOUSESEL, + "KDIRSC1":KDIRSC1, + "KDIRSC2":KDIRSC2, + "KDIRSC3":KDIRSC3, + "KDIRSC4":KDIRSC4, + "KDIRSC5":KDIRSC5, + "KDIRSC6":KDIRSC6, + "KDIRSC7":KDIRSC7, + "KDIRSC8":KDIRSC8, + "KDIRSC9":KDIRSC9, + "KDIRSC10":KDIRSC10, + "KDIRSC11":KDIRSC11, + "KDIRSC12":KDIRSC12, "MEMCLR1":MEMCLR1, "MEMCLR2":MEMCLR2, "MEMCLR3":MEMCLR3, @@ -955,14 +983,14 @@ # Ignore attempts to redefine a shortcut within the config file - if UI.FuncKeys[sc-1]: + if UI.DirSCKeys[sc-1]: WrnMsg(wDIRSCREDEF % (num, line)) return # Everything OK - process the entry else: - # Associate the directory with the correct function key - UI.FuncKeys[sc-1] = val + # Associate the directory with the correct shortcut key + UI.DirSCKeys[sc-1] = val # Add to Directory Menu making sure it is PSEP-terminated @@ -1439,6 +1467,24 @@ self.DirList.bind(self.KeyBindings["MOUSESEL"], MouseDblClick) + ##### + # Directory Shortcut Keys - All Bound To A Common Handler + ##### + + self.DirList.bind(self.KeyBindings["KDIRSC1"], lambda event :DirSCKeyPress(event, 1)) + self.DirList.bind(self.KeyBindings["KDIRSC2"], lambda event :DirSCKeyPress(event, 2)) + self.DirList.bind(self.KeyBindings["KDIRSC3"], lambda event :DirSCKeyPress(event, 3)) + self.DirList.bind(self.KeyBindings["KDIRSC4"], lambda event :DirSCKeyPress(event, 4)) + self.DirList.bind(self.KeyBindings["KDIRSC5"], lambda event :DirSCKeyPress(event, 5)) + self.DirList.bind(self.KeyBindings["KDIRSC6"], lambda event :DirSCKeyPress(event, 6)) + self.DirList.bind(self.KeyBindings["KDIRSC7"], lambda event :DirSCKeyPress(event, 7)) + self.DirList.bind(self.KeyBindings["KDIRSC8"], lambda event :DirSCKeyPress(event, 8)) + self.DirList.bind(self.KeyBindings["KDIRSC9"], lambda event :DirSCKeyPress(event, 9)) + self.DirList.bind(self.KeyBindings["KDIRSC10"], lambda event :DirSCKeyPress(event, 10)) + self.DirList.bind(self.KeyBindings["KDIRSC11"], lambda event :DirSCKeyPress(event, 11)) + self.DirList.bind(self.KeyBindings["KDIRSC12"], lambda event :DirSCKeyPress(event, 12)) + + ### # Memory Keys - All Features Bound To A Common Handler ### @@ -1470,15 +1516,6 @@ self.DirList.bind(self.KeyBindings["MEMSET12"], lambda event : KeyMemHandler(mem=12)) - ##### - # Function Keys - ##### - - # Bind function keys to a common handler - for x in range(len(self.FuncKeys)): - self.DirList.bind('' % (x+1), lambda event, index=x :FuncKeypress(event, index)) - - # Give the listbox focus so it gets keystrokes self.DirList.focus() @@ -2260,19 +2297,11 @@ # Event Handler: Handler Function Keys ##### -def FuncKeypress(event, index): +def DirSCKeyPress(event, index): - # Only simple Function Key presses are accepted - # Modification by Ctl, Alt, etc. are ignored. - # This means event.state should be 0 after we - # mask off the "don't care" bits - - if (event.state & ~DontCareMask): - return "break" - # Process the keypress - dir = UI.FuncKeys[index] + dir = UI.DirSCKeys[index-1] if dir: LoadDirList(dir) @@ -2280,7 +2309,7 @@ # have default behavior in Tk which we want to suppress. return "break" -# End of 'FuncKeypress()' +# End of 'DirSCKeyPress()' #-------------------- Memory Features --------------------# @@ -3294,9 +3323,9 @@ def GetDirShortcuts(): debuginfo = [] - for x in range(len(UI.FuncKeys)): + for x in range(len(UI.DirSCKeys)): key = "F" + str(x+1) - path = UI.FuncKeys[x] + path = UI.DirSCKeys[x] if path: debuginfo.append(PadString(key, dSCWIDTH) + path)