diff --git a/twander.py b/twander.py index 55a2ff5..7591198 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.44 2003/01/04 22:52:13 tundra Exp $" +RCSID = "$Id: twander.py,v 2.45 2003/01/05 16:56:23 tundra Exp $" VERSION = RCSID.split()[2] @@ -1084,11 +1084,10 @@ def UpdateTitle(self, mainwin): - mainwin.title(PROGNAME + " " + VERSION + - " " + HOSTNAME + ": "+ - UI.CurrentDir + " Total Files: " + - str(UI.DirList.size()) + - " Total Size: " + FileLength(UI.TotalSize)) + mainwin.title(PROGNAME + " " + VERSION + " " + HOSTNAME + \ + ": "+ UI.CurrentDir + " Total Files: " + \ + str(self.DirList.size()) + \ + " Total Size: " + FileLength(self.TotalSize)) # End of method 'twanderUI.UpdateTitle()' @@ -1571,10 +1570,6 @@ elif OSNAME == 'posix': thread.start_new_thread(os.system, (os.path.join(os.path.abspath(UI.CurrentDir), selected),)) - - # Have to update the window title because selection changed - UI.UpdateTitle(UIroot) - # End of 'DirListHandler()' @@ -1688,9 +1683,6 @@ UI.DirBtn.menu.add_command(label=dir, command=lambda dir=dir: LoadDirList(dir)) UI.DirBtn['menu'] = UI.DirBtn.menu - # And update the title to reflect changes - UI.UpdateTitle(UIroot) - # And always force selection of first item there. # This guarantees a selection in the new # directory context, so subsequent commands @@ -1699,6 +1691,9 @@ KeySelTop(None) + # Update titlebar to reflect any changes + UI.UpdateTitle(UIroot) + #Release the lock UI.DirListMutex.unlock() @@ -1733,7 +1728,6 @@ dList.sort() fList.sort() - # Entry to move up one directory is always first, # no matter what the sort. This is necessary because # OSs like Win32 like to use '$' in file names which @@ -1745,13 +1739,10 @@ # without details, so we can return directly from here. else: - return GetWin32Drives() + UI.TotalSize = 0 + return GetWin32Drives() - # If user has not requested detailed display, we're done - if not UI.DetailsOn: - return dList + fList - - # Detailed display requested, do the work + # Get details on directory contents all = dList + fList detlist = [] @@ -1887,7 +1878,10 @@ detlist[index] += SYMPTR + f - return detlist + if UI.DetailsOn: + return detlist + else: + return dList + fList # End of 'BuildDirList()' @@ -1930,6 +1924,9 @@ UI.DirList.xview(MOVETO, xs[0]) UI.DirList.yview(MOVETO, ys[0]) + # Update titlebar to reflect any changes + UI.UpdateTitle(UIroot) + # Release the mutex UI.DirListMutex.unlock() @@ -2064,6 +2061,19 @@ if len(args) == 1: STARTDIR = args[0] + + # Windows is sloppy about accepting both '//' and '\\' + # so we have to condition the command line input for consistency. + + if OSNAME == 'nt' and STARTDIR == '//': + STARTDIR = SHOWDRIVES + + # Make sure any user request to start in a Drive List View + # is possible. If not, just start in the root directory. + + if STARTDIR == SHOWDRIVES and (OSNAME != 'nt' or not GetWin32Drives()): + STARTDIR = PSEP + if not os.path.isdir(STARTDIR): ErrMsg(eBADROOT % STARTDIR) sys.exit(1)