diff --git a/twander.py b/twander.py index 7d5d12b..f25dabe 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.54 2002/11/14 23:26:39 tundra Exp $" +RCSID = "$Id: twander.py,v 1.55 2002/11/15 09:47:43 tundra Exp $" VERSION = RCSID.split()[2] @@ -30,16 +30,16 @@ # Key Assignments ##### -CHANGEDIR = '' -GOHOME = '' -GOPREV = '' -GOSTART = '' -GOUP = '' -KEYPRESS = '' -QUITPROG = '' -READCONF = '' -SELECTKEY = '' -SELECTMOUSE = '' +CHANGEDIR = '' +DIRHOME = '' +DIRPREV = '' +DIRSTART = '' +DIRUP = '' +KEYPRESS = '' +QUITPROG = '' +READCONF = '' +SELKEY = '' +SELMOUSE = '' ##### @@ -187,7 +187,7 @@ def ErrMsg(emsg): - showerror(PROGNAME + " " + VERSION + " " + eERROR, eERROR + ": " + emsg) + showerror(PROGNAME + " " + VERSION + " " + eERROR, eERROR + ": " + emsg) # End of 'ErrMsg()' @@ -198,7 +198,7 @@ def WrnMsg(wmsg): if WARN: - showwarning(PROGNAME + " " + VERSION + " " + wWARN, wWARN + ": " + wmsg) + showwarning(PROGNAME + " " + VERSION + " " + wWARN, wWARN + ": " + wmsg) # End of 'WrnMsg()' @@ -285,8 +285,21 @@ ##### def Usage(): + ustring ="" + for x in uTable: - print x + ustring += x + "\n" + + # Build and display in a window + + root = Tk() + root.title(PROGNAME + " " + VERSION) + label = Label(root, + justify=LEFT, + font=(FNAME, FSZ, FWT), + text=ustring) + label.pack() + root.mainloop() # End of 'Usage()' @@ -313,7 +326,7 @@ self.DirList = Listbox(root, foreground = FCOLOR, background = BCOLOR, - font = (FNAME, FSZ, FWT), + font=(FNAME, FSZ, FWT), selectmode=BROWSE, exportselection=0, xscrollcommand=self.hSB.set, @@ -346,25 +359,25 @@ root.bind(QUITPROG, KeyQuitProg) # Bind handler for "Home Dir" - root.bind(GOHOME, KeyHomeDir) + root.bind(DIRHOME, KeyHomeDir) # Bind handler for "Previous Dir" - root.bind(GOPREV, KeyPrevDir) + root.bind(DIRPREV, KeyPrevDir) # Bind handler for "Starting Dir" - root.bind(GOSTART, KeyStartDir) + root.bind(DIRSTART, KeyStartDir) # Bind handler for "Up Dir" - root.bind(GOUP, KeyUpDir) + root.bind(DIRUP, KeyUpDir) # Bind handler of "Read Config File" root.bind(READCONF, ParseConfFile) # Bind handler for "Item Select" - root.bind(SELECTKEY, DirListHandler) + root.bind(SELKEY, DirListHandler) # We'll accept Single-Clicks as a selection - self.DirList.bind(SELECTMOUSE, DirListHandler) + self.DirList.bind(SELMOUSE, DirListHandler) # Give the listbox focus so arrow keys work self.DirList.focus() @@ -529,7 +542,7 @@ ##### def BuildDirList(rootdir): - + dList, fList = [], [] # Walk the directory separate subdirs and files @@ -540,8 +553,16 @@ else: fList.append(file) except: + # Can't read selected directory - show error ErrMsg(eDIRRD % rootdir) + # Move up one directory level + KeyUpDir(None) + + # Satisfy the original call + return [] + + # Directory read was fine dList.sort() # Entry to move up one directory is always first,