diff --git a/twander.py b/twander.py index 1fc7938..e716a41 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.148 2005/01/07 07:54:44 tundra Exp $" +RCSID = "$Id: twander.py,v 3.149 2005/01/07 10:30:20 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -653,6 +653,7 @@ COMMANDMENU = 'Commands' # Title for Command Menu button DIRMENU = 'Directories' # Title for Directory Menu button HISTMENU = 'History' # Title for History Menu button +SCMENU = 'Shortcuts' # Title for Shortcut Menu button SORTMENU = 'Sorting' # Title for Sort Menu button WILDMENU = 'Wildcards' # Title for Wildcard Menu button HELPMENU = 'Help' # Title for Help Menu button @@ -1362,14 +1363,6 @@ # Associate the directory with the correct shortcut key UI.DirSCKeys[sc-1] = val - # Add to Directory Menu making sure it is PSEP-terminated - - if val and (val[-1] != PSEP): - val += PSEP - - if val: - UpdateDirMenu(val) - # User specified an invalid shortcut number else: WrnMsg(wBADSCNUM % (num, line), fn=file) @@ -1501,7 +1494,7 @@ # Any user-set options have now been read, set the GUI - for i in (UI.CmdBtn, UI.DirBtn, UI.HistBtn, UI.SortBtn, UI.WildBtn, UI.HelpBtn): + for i in (UI.CmdBtn, UI.DirBtn, UI.HistBtn, UI.ShortBtn, UI.SortBtn, UI.WildBtn, UI.HelpBtn): i.config(foreground=MFCOLOR, background=MBCOLOR, font=(MFNAME, MFSZ, MFWT)) i.menu.config(foreground=MFCOLOR, background=MBCOLOR, font=(MFNAME, MFSZ, MFWT)) @@ -1525,6 +1518,9 @@ # Initialize the Help Menu LoadHelpMenu() + # Initialize the Shortcut Menu + LoadShortcutMenu() + # Size and position the display UIroot.geometry("%sx%s+%s+%s" % (WIDTH, HEIGHT, STARTX, STARTY)) @@ -1621,6 +1617,42 @@ ##### +# Load The Shortcut Menu with the latest information +##### + +def LoadShortcutMenu(): + + UI.ShortBtn.config(state=DISABLED) + UI.ShortBtn.menu.delete(0,END) + + # Add Standard Navigation Shortcuts + + UI.ShortBtn.menu.add_command(label="Up", command=lambda: KeyUpDir(None)) + UI.ShortBtn.menu.add_command(label="Back", command=lambda: KeyBackDir(None)) + UI.ShortBtn.menu.add_command(label="Home", command=lambda: KeyHomeDir(None)) + UI.ShortBtn.menu.add_command(label="Startdir", command=lambda: KeyStartDir(None)) + UI.ShortBtn.menu.add_command(label="Root", command=lambda: KeyRootDir(None)) + + # Add Shortcut Key Definitions + + idx=1 + for entry in UI.DirSCKeys: + if entry: + pad=" " + if idx < 10: + pad += " " + UI.ShortBtn.menu.add_command(label="SC%s:%s%s" % (idx, pad, entry), command=lambda parm=idx: DirSCKeyPress(None, parm)) + idx += 1 + + # Enable the menu selections + + UI.ShortBtn['menu'] = UI.ShortBtn.menu + UI.ShortBtn.config(state=NORMAL) + +# End of 'LoadShortcutMenu()' + + +##### # Convert A String In Integer Or Hex Format To An Equivalent Numeric # We assume that the string is either in correct format or that # the calling routine will catch any error. @@ -1731,6 +1763,12 @@ self.HistBtn.menu = Menu(self.HistBtn) self.HistBtn.pack(side=LEFT, padx=MENUPADX) + # Setup the Shortcut Menu + + self.ShortBtn = Menubutton(self.mBar, text=SCMENU, underline=0, state=DISABLED) + self.ShortBtn.menu = Menu(self.ShortBtn) + self.ShortBtn.pack(side=LEFT, padx=MENUPADX) + # Setup the Sort Menu self.SortBtn = Menubutton(self.mBar, text=SORTMENU, underline=0, state=DISABLED)