diff --git a/twander.py b/twander.py index d672171..f932802 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.119 2003/03/01 11:05:35 tundra Exp $" +RCSID = "$Id: twander.py,v 3.120 2003/03/01 22:03:59 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -305,7 +305,7 @@ STRICTMATCH = CMDESCAPE # Tells wildcard system to enforce strict matching -# Sort Field Names +# Sort Field Names In Normal View fNONE = "None" fPERMISSIONS = "Permissions" @@ -316,6 +316,15 @@ fDATE = "Time" fNAME = "Name" +# Sort Field Names In Drive List View + +dlvNONE = "None" +dlvLABEL = "Label/Share" +dlvTYPE = "Drive Type" +dlvFREE = "Free Space" +dlvTOTAL = "Total Space" +dlvLETTER = "Drive Letter" + # 'Fake' sorting fields used to set SORTREVERSE and SORTSEPARATE fREVERSE = -1 @@ -329,8 +338,9 @@ Name2Key = {} index = -1 -for x in [fNONE, fPERMISSIONS, fLINKS, fOWNER, fGROUP, fLENGTH, fDATE, fNAME]: - Name2Key[x.lower()] = index +for x, y in [(fNONE, dlvNONE), (fPERMISSIONS, dlvLABEL), (fLINKS, dlvTYPE), (fOWNER, dlvFREE), + (fGROUP, dlvTOTAL), (fLENGTH, dlvLETTER), (fDATE, dlvLETTER), (fNAME, dlvLETTER)]: + Name2Key[x.lower()] = (index, y) index += 1 # Highest key index needed by Drive List View @@ -1946,11 +1956,21 @@ def UpdateTitle(self, mainwin): - mainwin.title("%s %s %s: %s %s %s %s %s %s %s %s %s %s %s" % + if UI.CurrentDir == SHOWDRIVES: + srtfld = Name2Key[SORTBYFIELD.lower()][1].upper() + fld3 = "" + + else: + srtfld = SORTBYFIELD.upper() + srtsep = YesOrNo[SORTSEPARATE] + fld3 = "%s %s" % (TTLSORTSEP, srtsep) + + fld1 = "%s %s " % (TTLSORTFLD, srtfld) + fld2 = "%s %s " % (TTLSORTREV, YesOrNo[SORTREVERSE]) + + mainwin.title("%s %s %s: %s %s %s %s %s %s%s%s" % (PROGNAME, VERSION, FULLNAME, UI.CurrentDir, - TTLFILES, str(self.DirList.size()), TTLSIZE, FileLength(self.TotalSize), - TTLSORTFLD, SORTBYFIELD.upper(), TTLSORTREV, YesOrNo[SORTREVERSE], - TTLSORTSEP, YesOrNo[SORTSEPARATE])) + TTLFILES, str(self.DirList.size()), TTLSIZE, FileLength(self.TotalSize), fld1, fld2, fld3)) # End of method 'twanderUI.UpdateTitle()' @@ -2804,11 +2824,21 @@ SORTREVERSE = not SORTREVERSE refresh = TRUE - elif parm == fSEPARATE: - SORTSEPARATE = not SORTSEPARATE - refresh = TRUE + # Separate Dirs/Files Means Nothing In Drive List View - Suppress + # this there to avoid an unnecessary refresh + + elif (parm == fSEPARATE): + if (UI.CurrentDir != SHOWDRIVES): + SORTSEPARATE = not SORTSEPARATE + refresh = TRUE - elif parm != SORTBYFIELD: + # Only actually change the sort key if it is different than last time + # Again we want to suppress unnecessary refreshes + + elif ((UI.CurrentDir != SHOWDRIVES) and (parm.lower() != SORTBYFIELD.lower())) or \ + ((UI.CurrentDir == SHOWDRIVES) and \ + (Name2Key[parm.lower()][1].lower() != Name2Key[SORTBYFIELD.lower()][1].lower())): + SORTBYFIELD = parm refresh = TRUE @@ -3084,7 +3114,7 @@ # Get and sort directory contents filelist = os.listdir(currentdir) - keyindex = Name2Key[SORTBYFIELD.lower()] + keyindex = Name2Key[SORTBYFIELD.lower()][0] dList, fList = [], [] @@ -3227,7 +3257,7 @@ # If the user has selected one of these, map them to sort # by name in Drive List View. - dlvkey = Name2Key[SORTBYFIELD.lower()] + 1 + dlvkey = Name2Key[SORTBYFIELD.lower()][0] + 1 if dlvkey > MAXDLVKEY: dlvkey = MAXDLVKEY