diff --git a/twander.py b/twander.py index 0627b12..5c8275a 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.39 2003/01/02 17:51:29 tundra Exp $" +RCSID = "$Id: twander.py,v 2.40 2003/01/02 21:20:40 tundra Exp $" VERSION = RCSID.split()[2] @@ -483,38 +483,31 @@ # Dump tables if we're debugging if int(DEBUGLEVEL) & DEBUGKEYS: - print dKEYBINDS + "\n" - keylist = [] - + debuginfo = [] for key in UI.KeyBindings.keys(): - keylist.append(key) - keylist.sort() + debuginfo.append(key + " " * (10-len(key)) + UI.KeyBindings[key]) - for key in keylist: - print key + " " * (10-len(key)) + UI.KeyBindings[key] - print + debuginfo.sort() + PrintDebug(dKEYBINDS, debuginfo) if int(DEBUGLEVEL) & DEBUGSYMS: - print dSYMTBL + "\n" - syms = [] + debuginfo = [] for sym in UI.SymTable.keys(): - syms.append(sym) - syms.sort() + debuginfo.append(sym + " " * (16-len(sym)) + UI.SymTable[sym]) - for sym in syms: - print sym + " " * (16-len(sym)) + UI.SymTable[sym] - print + debuginfo.sort() + PrintDebug(dSYMTBL, debuginfo) if int(DEBUGLEVEL) & DEBUGCTBL: - print dCMDTBL + "\n" + debuginfo = [] for key in UI.CmdTable.keys(): name = UI.CmdTable[key][0] cmd = UI.CmdTable[key][1] - print key + " " + name + " " * (16-len(name)) + cmd - print - + debuginfo.append(key + " " + name + " " * (16-len(name)) + cmd) + + PrintDebug(dCMDTBL, debuginfo) # End of 'ParseConfFile()' @@ -724,6 +717,23 @@ ##### +# Print Debug Information On stdout +##### + +def PrintDebug(title, content): + + print title + '\n' + if content: + for i in content: + print i + else: + print dNULL + print + +# End of 'PrintDebug()' + + +##### # Strip Trailing Path Separator ##### @@ -1120,7 +1130,7 @@ # Just dump command if we're debugging if int(DEBUGLEVEL) & DEBUGCMDS: - print dCMD, cmd, '\n' + PrintDebug(dCMD, [cmd,]) # Otherwise,actually execute the command else: @@ -1535,8 +1545,10 @@ if save and UI.CurrentDir: UI.LastDir.append(UI.CurrentDir) - if int(DEBUGLEVEL) & DEBUGDIRS: - print dDIRSTK, '\n', UI.LastDir, '\n' + + # Dump directory stack if debug requested it + if int(DEBUGLEVEL) & DEBUGDIRS: + PrintDebug(dDIRSTK, UI.LastDir) # And select new directory to visit UI.CurrentDir = newdir @@ -1907,10 +1919,13 @@ # Dump program variable during debug sessions if int(DEBUGLEVEL) & DEBUGVARS: - print dINTVAR + "\n" + + debuginfo = [] for v in DebugVars: - print v + " " * (12-len(v)) + (str(eval(v)) or dNULL) - print + debuginfo.append(v + " " * (12-len(v)) + (str(eval(v)) or dNULL)) + + PrintDebug(dINTVAR, debuginfo) + # Create an instance of the UI UIroot = Tk()