diff --git a/twander.py b/twander.py index de7446d..a39a613 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.30 2002/12/20 06:26:39 tundra Exp $" +RCSID = "$Id: twander.py,v 2.31 2002/12/21 22:24:12 tundra Exp $" VERSION = RCSID.split()[2] @@ -65,6 +65,7 @@ CHANGEDIR = '' # Enter a new path DIRHOME = '' # Goto $HOME DIRBACK = '' # Goto previous directory +DIRROOT = '' # Goto root directory DIRSTART = '' # Goto starting directory DIRUP = '' # Go up one directory level MOUSEBACK = '' # Go back one directory with mouse @@ -73,6 +74,7 @@ # Selection Keys SELALL = '' # Select all items +SELINV = '' # Invert the current selection SELNONE = '' # Unselect all items SELNEXT = '' # Select next item SELPREV = '' # Select previous item @@ -382,11 +384,13 @@ "CHANGEDIR":CHANGEDIR, "DIRHOME":DIRHOME, "DIRBACK":DIRBACK, + "DIRROOT":DIRROOT, "DIRSTART":DIRSTART, "DIRUP":DIRUP, "MOUSEBACK":MOUSEBACK, "MOUSEUP":MOUSEUP, "SELALL":SELALL, + "SELINV":SELINV, "SELNONE":SELNONE, "SELNEXT":SELNEXT, "SELPREV":SELPREV, @@ -793,6 +797,9 @@ # Bind handler for "Previous Dir" self.DirList.bind(self.KeyBindings["DIRBACK"], KeyBackDir) + # Bind handler for "Root Dir" + self.DirList.bind(self.KeyBindings["DIRROOT"], KeyRootDir) + # Bind handler for "Starting Dir" self.DirList.bind(self.KeyBindings["DIRSTART"], KeyStartDir) @@ -811,6 +818,9 @@ # Bind handler for "Select All" self.DirList.bind(self.KeyBindings["SELALL"], KeySelAll) + # Bind handler for "Invert Current Selection" + self.DirList.bind(self.KeyBindings["SELINV"], KeySelInv) + # Bind handler for "Select No Items" self.DirList.bind(self.KeyBindings["SELNONE"], KeySelNone) @@ -1107,7 +1117,19 @@ ##### -# Event Handler: Go Back to Initial Directory +# Event Handler: Go To Root Directory +##### + +def KeyRootDir(event): + global STARTDIR + + LoadDirList(PSEP) + +# End of 'KeyRootDir()' + + +##### +# Event Handler: Go Back To Initial Directory ##### def KeyStartDir(event): @@ -1119,7 +1141,7 @@ ##### -# Event Handler: Move up one directory +# Event Handler: Move Up One Directory ##### def KeyUpDir(event): @@ -1139,12 +1161,39 @@ ##### def KeySelAll(event): - UI.DirList.selection_set(0, END) + + # Unselect first item in case it was + UI.DirList.selection_clear(0) + + # We never want to select the first item which is ".." + UI.DirList.selection_set(1, END) # End of 'KeySelAll()' ##### +# Event Handler: Invert Current Selection +##### + +def KeySelInv(event): + + # List of current selections + cs= UI.DirList.curselection() + + # Select everything + UI.DirList.selection_set(0, END) + + # And unselect what was selected + for v in cs: + UI.DirList.selection_clear(v) + + # And we never select ".." this way + UI.DirList.selection_clear(0) + +# End of 'KeySelInv()' + + +##### # Event Handler: Select Next Item ##### @@ -1766,7 +1815,7 @@ DebugVars = ["RCSID","OSNAME", "STARTDIR", "HOME", "CONF", "HEIGHT", "WIDTH", "BCOLOR", "FCOLOR", "FNAME", "FSZ", "FWT", - "AUTOREFRESH", "DEBUG", "WARN", "QUOTECHAR", "POLLINT", "REFRESHINT"] + "AUTOREFRESH", "DEBUG", "WARN", "PSEP", "QUOTECHAR", "POLLINT", "REFRESHINT"] # Dump program variable during debug sessions if DEBUG: