diff --git a/twander.py b/twander.py index 5ac5045..acacb86 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.74 2002/11/23 03:15:43 tundra Exp $" +RCSID = "$Id: twander.py,v 1.75 2002/11/23 03:51:47 tundra Exp $" VERSION = RCSID.split()[2] @@ -142,7 +142,7 @@ ##### HOSTNAME = getfqdn() # Full name of this host -REFRESHINT = 1000 # Interval (ms) for automatic refresh +REFRESHINT = 5000 # Interval (ms) for automatic refresh ##### @@ -485,7 +485,7 @@ sellist = [] for entry in self.DirList.curselection(): - sellist.append(self.DirList.get(entry)) + sellist.append(self.DirList.get(entry)[UI.NameIndex:]) return sellist @@ -496,14 +496,14 @@ # Return name of currently selected item ##### - def LastSelection(self): + def LastInSelection(self): index = self.DirList.curselection() if index: - return self.DirList.get(index[-1]) + return self.DirList.get(index[-1])[UI.NameIndex:] else: return "" - # End of method 'twanderUI.LastSelection()' + # End of method 'twanderUI.LastInSelection()' ##### @@ -514,7 +514,8 @@ mainwin.title(PROGNAME + " " + VERSION + " " + HOSTNAME + ": "+ - UI.CurrentDir) + UI.CurrentDir + " Total: " + + str(UI.DirList.size())) # End of method 'twanderUI.UpdateTitle()' @@ -547,7 +548,7 @@ # Replace runtime-determined tokens - cmd = cmd.replace(FILE, UI.LastSelection()) + cmd = cmd.replace(FILE, UI.LastInSelection()) fstring = "" for selected in UI.AllSelection(): @@ -718,7 +719,7 @@ SAVE = TRUE # Get current selection. If none, just return, otherwise process - selected = UI.LastSelection() + selected = UI.LastInSelection() if not selected: return @@ -872,8 +873,20 @@ fList.sort() + # For both choices below, we have to set the UI.NameIndex + # value. This tells other handlers where in a given + # selection the actual name of the file can be found. + # This is necessary because we may be selecting a from + # a detailed view and need to know where in that view + # the file name lives. It is not good enoch to just + # split() the string and use the [-1] entry because + # we may be dealing with a file which has spaces in its + # name. + + # If user has not requested detailed display, we're done if not DETAILVIEW: + UI.NameIndex = 0 return dList + fList # Detailed display requested, do the work @@ -898,13 +911,13 @@ # Default names for all other OSs else: - owner = 'unknown' - group = 'unknown' + owner = OSNAME + 'user' + group = OSNAME + 'group' # Add them to the detail - detlist[index] += owner + (9 - len(owner)) * " " - detlist[index] += group + (9 - len(group)) * " " + detlist[index] += owner + (12 - len(owner)) * " " + detlist[index] += group + (12 - len(group)) * " " # Length detlist[index] += str(stinfo[6]) + (11 - len(str(stinfo[6]))) * " " @@ -913,6 +926,9 @@ ftime = " ".join(time.ctime(stinfo[9]).split()[1:]) detlist[index] += ftime + (21 - len(ftime)) * " " + # Set the index into the file name + UI.NameIndex = len(detlist[index]) + # File name detlist[index] += all[index] @@ -933,7 +949,6 @@ # Get current selection and active sellist = UI.DirList.curselection() - selected = UI.LastSelection() active = UI.DirList.index(ACTIVE) @@ -960,16 +975,8 @@ KeySelTop(args) UI.NewDirEntered = FALSE - # Otherwise, preserve the values across refreshes + # Otherwise restore selections else: - - # If possible, maintain selection of same *item*. - # If not, maintain same *position* in widget (set above). - - if selected in newlist: - selindex = newlist.index(selected) - - # Restore active item SetSelection(sellist, active) # Restore scroll positions