diff --git a/twander.py b/twander.py index 98d477f..901c8f5 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.40 2002/11/10 21:47:59 tundra Exp $" +RCSID = "$Id: twander.py,v 1.41 2002/11/11 21:00:09 tundra Exp $" VERSION = RCSID.split()[2] @@ -206,7 +206,7 @@ fList.sort() return dList + fList -# End 'BuildDirList()' +# End of 'BuildDirList()' ##### @@ -388,6 +388,12 @@ # Set up keystroke handler for application root.bind('', KeystrokeHandler) + # Bind handler for Esc key + root.bind('', KeyEsc) + + # Bind handler for Home key + root.bind('', KeyHome) + # Make sure the top level window has input focus root.focus() @@ -443,6 +449,30 @@ ##### +# Event Handler For Esc Key - Program Quit +##### + +def KeyEsc(event): + + sys.exit() + +# End of 'KeyEsc()' + + +##### +# Event Handler For Home Key - Go Back to Initial Directory +##### + +def KeyHome(event): + global ROOTDIR, STARTDIR + + ROOTDIR = STARTDIR + LoadDirList() + +# End of 'KeyHome()' + + +##### # Event Handler For Individual Keystrokes ##### @@ -465,7 +495,7 @@ os.system(cmd) -# end of 'KeystrokeHandler() +# end of 'KeystrokeHandler()' #----------------------------------------------------------# @@ -544,6 +574,9 @@ UI = twanderUI(UIroot) +# Save the initial starting directory in case we want to return later +STARTDIR = ROOTDIR + # Initialize the UI directory listing LoadDirList()