diff --git a/twander.py b/twander.py index 6c62ceb..5390c4f 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.139 2004/03/10 23:58:17 tundra Exp $" +RCSID = "$Id: twander.py,v 3.140 2004/03/11 03:31:33 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -267,6 +267,7 @@ # Defaults ##### +AFTERWAIT = 1 # Seconds to wait before REFRESHAFTER AUTOREFRESH = TRUE # Automatically refresh the directory display? CMDSHELL = "" # No CMDSHELL processing DEBUGLEVEL = 0 # No debug output @@ -302,6 +303,7 @@ NUMPROGMEM = 12 # Number of program memories POLLINT = 20 # Interval (ms) the poll routine should run PSEP = os.sep # Character separating path components +REFRESHAFTER = '+' # Indicate we want a refresh after a command runs SHOWDRIVES = '\\\\' # Logical directory name for Win32 Drive Lists STRICTMATCH = CMDESCAPE # Tells wildcard system to enforce strict matching @@ -2324,6 +2326,7 @@ if cmd: ExecuteCommand(cmd, name) + # end of 'KeystrokeHandler()' @@ -2799,15 +2802,29 @@ # Execute command (if any) - Blank entry means do nothing/return if cmd: - # Do CMDSHELL Processing if enabled and requested mycmd = cmd + # Keep track of whether or not the user asked for a refreshe after command completion + # We have to strip it here of CMDSHELL processing will work. + + do_refresh_after = FALSE + if mycmd[0] == REFRESHAFTER: + do_refresh_after = TRUE + mycmd = mycmd[1:] + + # Do CMDSHELL Processing if enabled and requested + if CMDSHELL and DoCmdShell: # See if feature is enabled and requested if not mycmd.startswith(CMDSHELLESC): # See if user is trying to escape the feature - mycmd = "%s '%s'" % (CMDSHELL, cmd) + mycmd = "%s '%s'" % (CMDSHELL, mycmd) else: # User is escaping the feature mycmd = mycmd[1:] - + + # Request refreshing after command completion if it was desired + + if do_refresh_after: + mycmd = REFRESHAFTER + mycmd + ExecuteCommand(mycmd, pMANUALCMD, ResolveVars=TRUE, SaveUnresolved=TRUE) # Save the command only if Command History is enabled (MAXMENU > 0) @@ -3083,11 +3100,20 @@ # Work with a copy of the passed command newcmd = cmd - + # Process references to any Built-In variables if ResolveBuiltIns: newcmd = ProcessBuiltIns(cmd, name) + # A leading REFRESHAFTER in the command string means the user wants + # a display refresh after the command returns + + do_refresh_after = False + if newcmd[0] == REFRESHAFTER: + newcmd = newcmd[len(REFRESHAFTER):] + do_refresh_after = True + + # Replace references to any Environment or User-Defined variables # but only when asked to. - i.e., The command was manually # entered by the user and may contain unresolved variables. @@ -3142,6 +3168,14 @@ if DEBUGLEVEL & DEBUGHIST: PrintDebug(dHIST, UI.CmdHist) + + + # Do a display refresh if the user wanted it + # Wait a while to give the command a chance to complete + + if do_refresh_after: + time.sleep(AFTERWAIT) + RefreshDirList() # End of 'ExecuteCommand() @@ -4365,8 +4399,8 @@ "SORTREVERSE":SORTREVERSE, "SORTSEPARATE":SORTSEPARATE, "USETHREADS":USETHREADS, "USEWIN32ALL":USEWIN32ALL, "WARN":WARN} -UI.OptionsNumeric = {"DEBUGLEVEL":DEBUGLEVEL, "FSZ":FSZ, "MFSZ":MFSZ, "HFSZ":HFSZ, "HEIGHT":HEIGHT, - "MAXMENU":MAXMENU, "MAXMENUBUF":MAXMENUBUF, "MAXNESTING":MAXNESTING, +UI.OptionsNumeric = {"AFTERWAIT":AFTERWAIT,"DEBUGLEVEL":DEBUGLEVEL, "FSZ":FSZ, "MFSZ":MFSZ, "HFSZ":HFSZ, + "HEIGHT":HEIGHT, "MAXMENU":MAXMENU, "MAXMENUBUF":MAXMENUBUF, "MAXNESTING":MAXNESTING, "REFRESHINT":REFRESHINT, "STARTX":STARTX, "STARTY":STARTY, "WIDTH":WIDTH} UI.OptionsString = {"BCOLOR":BCOLOR, "FCOLOR":FCOLOR, "FNAME":FNAME, "FWT":FWT, # Main Font/Colors