diff --git a/twander.py b/twander.py index 597ffca..27430d8 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.203 2006/12/15 08:11:24 tundra Exp $" +RCSID = "$Id: twander.py,v 3.204 2006/12/15 23:10:22 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -34,7 +34,7 @@ from Tkinter import * from tkMessageBox import askyesno, showerror, showinfo, showwarning -from tkSimpleDialog import askstring +from tkSimpleDialog import askinteger, askstring ##### # Imports conditional on OS @@ -147,21 +147,7 @@ KDIRSC10 = '' KDIRSC11 = '' KDIRSC12 = '' - -# Set Directory Shortcuts - -KSETSC1 = '' -KSETSC2 = '' -KSETSC3 = '' -KSETSC4 = '' -KSETSC5 = '' -KSETSC6 = '' -KSETSC7 = '' -KSETSC8 = '' -KSETSC9 = '' -KSETSC10 = '' -KSETSC11 = '' -KSETSC12 = '' +KDIRSCSET = "" # Program Memories @@ -703,10 +689,10 @@ TTLAUTO = "Auto:" TTLHIDEDOT = "HideDot:" -TTLFILES = "Total Files:" +TTLFILES = "Files:" TTLFILTER = "Filter:" -TTLSIZE = "Total Size:" -TTLSORTFLD = "Sort By:" +TTLSIZE = "Size:" +TTLSORTFLD = "Sort:" TTLSORTREV = "Rev:" TTLSORTSEP = "Sep:" @@ -754,7 +740,7 @@ # Errors -eBADROOT = " %s Is Not A Directory" +eBADROOT = "%s Is Not A Directory" eDIRRD = "Cannot Open Directory : %s --- Check Permissions." eERROR = "ERROR" eINITDIRBAD = "Cannot Open Starting Directory : %s - Check Permissions - ABORTING!." @@ -768,6 +754,8 @@ # Prompts pCHPATH = "Change Path" +pSCCHANGE = "Change Directory Shortcut" +pSCNUM = "Assign Current Directory To Shortcut # (1-12):" pENCMD = "Enter Command To Run:" pENPATH = "Enter New Path Desired:" pENWILD = "Enter Wildcard - Use %s For Strict Matching:" % STRICTMATCH @@ -1251,18 +1239,7 @@ "KDIRSC10":KDIRSC10, "KDIRSC11":KDIRSC11, "KDIRSC12":KDIRSC12, - "KSETSC1":KSETSC1, - "KSETSC2":KSETSC2, - "KSETSC3":KSETSC3, - "KSETSC4":KSETSC4, - "KSETSC5":KSETSC5, - "KSETSC6":KSETSC6, - "KSETSC7":KSETSC7, - "KSETSC8":KSETSC8, - "KSETSC9":KSETSC9, - "KSETSC10":KSETSC10, - "KSETSC11":KSETSC11, - "KSETSC12":KSETSC12, + "KDIRSCSET":KDIRSCSET, "MEMCLR1":MEMCLR1, "MEMCLR2":MEMCLR2, "MEMCLR3":MEMCLR3, @@ -2342,25 +2319,11 @@ self.DirList.bind(self.KeyBindings["KDIRSC11"], lambda event :DirSCKeyPress(event, 11)) self.DirList.bind(self.KeyBindings["KDIRSC12"], lambda event :DirSCKeyPress(event, 12)) - - ### - # Set Directory Shortcut Keys - All Bound To A Common Handler - ### + # Open Dialog To Load Current Directory Into User-Selected Shortcut - self.DirList.bind(self.KeyBindings["KSETSC1"], lambda event :DirSCSet(event, 1)) - self.DirList.bind(self.KeyBindings["KSETSC2"], lambda event :DirSCSet(event, 2)) - self.DirList.bind(self.KeyBindings["KSETSC3"], lambda event :DirSCSet(event, 3)) - self.DirList.bind(self.KeyBindings["KSETSC4"], lambda event :DirSCSet(event, 4)) - self.DirList.bind(self.KeyBindings["KSETSC5"], lambda event :DirSCSet(event, 5)) - self.DirList.bind(self.KeyBindings["KSETSC6"], lambda event :DirSCSet(event, 6)) - self.DirList.bind(self.KeyBindings["KSETSC7"], lambda event :DirSCSet(event, 7)) - self.DirList.bind(self.KeyBindings["KSETSC8"], lambda event :DirSCSet(event, 8)) - self.DirList.bind(self.KeyBindings["KSETSC9"], lambda event :DirSCSet(event, 9)) - self.DirList.bind(self.KeyBindings["KSETSC10"], lambda event :DirSCSet(event, 10)) - self.DirList.bind(self.KeyBindings["KSETSC11"], lambda event :DirSCSet(event, 11)) - self.DirList.bind(self.KeyBindings["KSETSC12"], lambda event :DirSCSet(event, 12)) - + self.DirList.bind(self.KeyBindings["KDIRSCSET"], lambda event :DirSCSet(event)) + ### # Memory Keys - All Features Bound To A Common Handler ### @@ -3673,13 +3636,17 @@ # Event Handler: Set Desired Directory Shortcut Key To Current Directory ##### -def DirSCSet(event, index): +def DirSCSet(event): + + index = askinteger(pSCCHANGE, pSCNUM, minvalue=1, maxvalue=12) + UI.DirList.focus() # Set the indicated shortcut key to the current directory # And update the menus to reflect this fact - UI.DirSCKeys[index-1] = UI.CurrentDir - LoadShortcutMenu() + if index: + UI.DirSCKeys[index-1] = UI.CurrentDir + LoadShortcutMenu() # Inhibit further processing of key - some Function Keys # have default behavior in Tk which we want to suppress.