diff --git a/twander.py b/twander.py index 1ecb298..aada2cb 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.23 2002/10/30 23:28:35 tundra Exp $" +RCSID = "$Id: twander.py,v 1.24 2002/11/08 20:55:14 tundra Exp $" VERSION = RCSID.split()[2] @@ -62,8 +62,8 @@ CONFFILE = os.path.join(os.getenv("HOME"), # Name of default config file "." + - PROGNAME + - "rc") + PROGNAME + ) CMDKEY = r'&' # Command key delimiter COMMENT = r"#" # Comment character @@ -134,6 +134,7 @@ ) DirList = gui.ListBox() + MainWin.add(DirList, hstretch=1, vstretch=1, @@ -156,36 +157,11 @@ # Object Base Class Definitions # #----------------------------------------------------------# - #----------------------------------------------------------# -# Supporting Function Definitions # +# GUI Handlers & Supporting Functions # #----------------------------------------------------------# -##### -# Return Ordered List Of Directories & Files For Current Root -##### - -def BuildDirList(rootdir): - - dList, fList = [], [] - dList.append(DIR_LDELIM + ".." + DIR_RDELIM) # Always show one directory up - - try: - for file in os.listdir(rootdir): - if os.path.isdir(os.path.join(rootdir,file)): - dList.append(DIR_LDELIM + file + DIR_RDELIM) - else: - fList.append(file) - except: - ErrMsg(eDIRRD % rootdir) - - dList.sort() - fList.sort() - return dList + fList - -# End 'BuildDirList()' - ##### # Event Handler For Directory Listing ListBox @@ -195,6 +171,7 @@ global rootdir selected = DirList.items[DirList._get_selection()] + # If selection is a directory, move there and list contents. # We examine this by checking the string for the directory # delimiter characters previously inserted in BuildDirList() @@ -228,12 +205,53 @@ MainWin.set(title= PROGNAME + " " + VERSION + " " + rootdir) else: - print("Not a DIR!") +# os.system(rcfile["ls"][1].replace("[NAME]", os.path.join(rootdir, selected)) + "&") + pass -# End of 'DirList_Handler() +# End of 'DirList_Handler()' ##### +# Main Message Handler +##### + +def Message_Handler(**kwargs): + print kwargs + +# End of 'Message_Handler()' + + + +#----------------------------------------------------------# +# Supporting Function Definitions # +#----------------------------------------------------------# + +##### +# Return Ordered List Of Directories & Files For Current Root +##### + +def BuildDirList(rootdir): + + dList, fList = [], [] + dList.append(DIR_LDELIM + ".." + DIR_RDELIM) # Always show one directory up + + try: + for file in os.listdir(rootdir): + if os.path.isdir(os.path.join(rootdir,file)): + dList.append(DIR_LDELIM + file + DIR_RDELIM) + else: + fList.append(file) + except: + ErrMsg(eDIRRD % rootdir) + + dList.sort() + fList.sort() + return dList + fList + +# End 'BuildDirList()' + + +##### # Print An Error Message ##### @@ -395,7 +413,10 @@ MainWin.set(title= PROGNAME + " " + VERSION + " " + rootdir) -# Link ListBox handler +# Link to message monitoring handler +gui.link(gui.any, gui.any, Message_Handler) + +# Link to ListBox handler gui.link(DirList, DirList_Handler)