diff --git a/twander.py b/twander.py index 0f7e52d..83b3d79 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.37 2002/11/09 20:30:49 tundra Exp $" +RCSID = "$Id: twander.py,v 1.38 2002/11/10 00:21:25 tundra Exp $" VERSION = RCSID.split()[2] @@ -368,42 +368,18 @@ self.vSB.pack(side=RIGHT, fill=Y) self.DirList.pack(side=LEFT, fill=BOTH, expand=1) - # Start polling the listbox for changes - # This is because Tk is braindamaged and - # cannot automatically track selection changes. - # So, we keep track of the index last selected - # constantly comparing it with the new one - # to watch for a change. Yuk! - - self.lastsel = None - self.poll() - - def poll(self): - cursel = self.DirList.curselection() - if cursel != self.lastsel: - self.lastsel = cursel - DirListHandler(cursel) - - # Go back to sleep for a while - self.DirList.after(150, self.poll) - # End of class definition, 'twanderUI' ##### -# Event Handler For Directory Listing ListBox +# Double-Click Event Handler For Directory Listing ListBox ##### -def DirListHandler(index): +def DirListHandler(event): global ROOTDIR - # Ignore cases with no selection - if not index: - return - - # Otherwise, get the actual string selected - selected = UI.DirList.get(int(index[0])) + selected = UI.DirList.get(ACTIVE) # If selection is a directory, move there and list contents. # We examine this by checking the string for the directory @@ -435,7 +411,8 @@ LoadDirList() else: - print selected + " Not a dir" + # If its not a dir, we ignore double-clicks + pass # End of 'DirListHandler()' @@ -520,6 +497,9 @@ # Initialize the UI directory listing LoadDirList() +# Set up handler for double-clicks in list box +UI.DirList.bind('', DirListHandler) + # Run the program interface UIroot.mainloop()