diff --git a/twander.py b/twander.py index 231c217..2af252c 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.44 2002/11/12 01:59:02 tundra Exp $" +RCSID = "$Id: twander.py,v 1.45 2002/11/12 10:02:13 tundra Exp $" VERSION = RCSID.split()[2] @@ -142,7 +142,7 @@ " -f color foreground color (default: green)", " -h print this help information", " -n name name of font to use (default: courier)", - " -q quiet mode - no warnings (default: warnings on)", + " -q quiet mode - no warnings (default: warnings on)", " -s size size of font to use (default: 12)", " -v print detailed version information", " -w wght weight/style of font to use (default: bold)", @@ -400,6 +400,15 @@ # Load UI with new directory LoadDirList(selected) + # And always force selection of first item there. + # This guarantees a selection in the new + # directory context, so subsequent commands + # won't try to operate on an item selected in a + # previoius directory + + INDEX = ('0',) + UI.DirList.selection_set(INDEX) + # File was selected. Save its full name for later use. else: FILESELECTED = os.path.join(ROOTDIR, selected) @@ -447,8 +456,11 @@ self.DirList.pack(side=LEFT, fill=BOTH, expand=1) # Bind the relevant widget event handlers + + # We'll accept Single- or Double-Clicks as a selection self.DirList.bind('', DirListHandler) + # Bind the relevant root window handlers # Bind handler for Backspace key @@ -461,7 +473,7 @@ root.bind('', KeyHome) # Bind handler for Left Arrow key - root.bind('', KeyLeft) +# root.bind('<-Left>', KeyLeft) # Set up keystroke handler for application # These will be checked against the command @@ -489,8 +501,11 @@ # whenever we rapidly clicked into a directory with only one entry (".."), # because any click in a blank area of the screen would return (). - INDEX = event.widget.nearest(event.y) - ProcessSelection() +# INDEX = event.widget.nearest(event.y) + INDEX = event.widget.curselection() + + if INDEX: + ProcessSelection() # End of 'DirListHandler()' @@ -565,14 +580,14 @@ # cmd == null means no matching command key - do nothing # Otherwise, replace config tokens with actual file/dir names - if cmd: + + # Replace runtime-determined tokens cmd = cmd.replace(FILENAME, FILESELECTED) cmd = cmd.replace(DIRNAME, ROOTDIR) - # Actually execute the command - - os.system(cmd) + # Actually execute the command + os.system(cmd) # end of 'KeystrokeHandler()'