diff --git a/twander.py b/twander.py index b448817..6aa23d0 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.77 2002/11/23 10:35:44 tundra Exp $" +RCSID = "$Id: twander.py,v 1.78 2002/11/24 18:44:51 tundra Exp $" VERSION = RCSID.split()[2] @@ -259,25 +259,24 @@ ##### -# Print An Information Message +# Convert A File Size Into Equivalent String With Scaling +# Files under 1 MB show actual length +# Files < 1 MB < 1 GB shown in KB +# Files 1 GB or greater, shown in MB ##### -def InfoMsg(emsg): +def FileLength(flen): - showinfo(PROGNAME + " " + VERSION + " " + iINFO, emsg) + if flen >= GB: + flen = str(flen/MB) + "m" + elif flen >= MB: + flen = str(flen/KB) + "k" + else: + flen = str(flen) -# End of 'ErrMsg()' + return flen - -##### -# Print A Warning Message -##### - -def WrnMsg(wmsg): - if WARN: - showwarning(PROGNAME + " " + VERSION + " " + wWARN, wmsg) - -# End of 'WrnMsg()' +# End of 'FileLength()' ##### @@ -377,6 +376,17 @@ # End of 'Usage()' +##### +# Print A Warning Message +##### + +def WrnMsg(wmsg): + if WARN: + showwarning(PROGNAME + " " + VERSION + " " + wWARN, wmsg) + +# End of 'WrnMsg()' + + #----------------------------------------------------------# # GUI Definition # #----------------------------------------------------------# @@ -532,8 +542,9 @@ mainwin.title(PROGNAME + " " + VERSION + " " + HOSTNAME + ": "+ - UI.CurrentDir + " Total: " + - str(UI.DirList.size())) + UI.CurrentDir + " Total Files: " + + str(UI.DirList.size()) + + " Total Size: " + FileLength(UI.TotalSize)) # End of method 'twanderUI.UpdateTitle()' @@ -911,6 +922,7 @@ all = dList + fList detlist = [] + UI.TotalSize = 0 for index in range(len(all)): try: stinfo = os.stat(os.path.join(currentdir, all[index])) @@ -956,18 +968,9 @@ detlist[index] += group + (12 - len(group)) * " " # Length - # Files under 1 MB show actual length - # Files < 1 MB < 1 GB shown in KB - # Files 1 GB or greater, shown in MB - flen = stinfo[6] - if flen >= GB: - flen = str(flen/MB) + "m" - elif flen >= MB: - flen = str(flen/KB) + "k" - else: - flen = str(flen) - + flen = FileLength(stinfo[6]) + UI.TotalSize += stinfo[6] detlist[index] += flen + (11 - len(flen)) * " " # Ctime