diff --git a/twander.py b/twander.py index 7e9ba7c..6ece9dc 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.66 2002/11/19 23:04:15 tundra Exp $" +RCSID = "$Id: twander.py,v 1.67 2002/11/20 23:55:16 tundra Exp $" VERSION = RCSID.split()[2] @@ -128,13 +128,10 @@ REFRESHINT = 2000 # Interval (ms) for automatic refresh -# Note whether we're running on Unix or not +# Set OS type - this allows us to trigger OS-specific code +# where needed. -if os.name == 'posix': - UNIX = TRUE -else: - UNIX = FALSE - +OSNAME = os.name ##### # General Literals @@ -675,7 +672,7 @@ # If we're on Unix, don't follow symlinks pointing back to themselves - if UNIX and os.path.samefile(UI.CurrentDir, UI.CurrentDir + selected): + if OSNAME == 'posix' and os.path.samefile(UI.CurrentDir, UI.CurrentDir + selected): WrnMsg(wSYMBACK % (UI.CurrentDir + selected)) return @@ -713,9 +710,12 @@ SetSelection(0) - # File selected - else: - pass + # File selected with a double-click + # If we're running Win32, use OS association to try and run it. + + elif OSNAME == 'nt': + os.startfile(os.path.join(os.path.abspath(UI.CurrentDir), selected)) + # Have to update the window title because selection changed UI.UpdateTitle(UIroot) @@ -872,17 +872,8 @@ UI.DirList.activate(index) UI.DirList.select_set(index) - # And make sure it is visible within the current window UI.DirList.see(index) - # And force a visual update - UI.DirList.pack() - - # We have to update the title because the selection - # may have changed. - - UI.UpdateTitle(UIroot) - # End of 'SetSelection()'