diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2003-01-14 22:03:31 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2003-01-14 22:03:31 (GMT) |
commit | 8e92bf7699ac3617d3a0a9a55a38f642f5a6ecc6 (patch) | |
tree | 8e4486a10f7b3e00124724d0f1fe717fbb6c1f2e /Lib/idlelib/EditorWindow.py | |
parent | 50e92235e7fc7151f591f76b73fb539e34593405 (diff) | |
download | cpython-8e92bf7699ac3617d3a0a9a55a38f642f5a6ecc6.zip cpython-8e92bf7699ac3617d3a0a9a55a38f642f5a6ecc6.tar.gz cpython-8e92bf7699ac3617d3a0a9a55a38f642f5a6ecc6.tar.bz2 |
M Bindings.py
M EditorWindow.py
M NEWS.txt
M config-main.def
M configDialog.py
M configHandler.py
M configHelpSourceEdit.py
M configSectionNameDialog.py
- Change default: IDLE now starts with Python Shell.
- Removed the File Path from the Additional Help Sources scrolled list.
- Add capability to access Additional Help Sources on the web if the
Help File Path begins with //http or www. (Otherwise local path is
validated, as before.)
- Additional Help Sources were not being posted on the Help menu in the
order entered. Implement sorting the list by [HelpFiles] 'option'
number.
- Add Browse button to New Help Source dialog. Arrange to start in
Python/Doc if platform is Windows, otherwise start in current directory.
- Put the Additional Help Sources directly on the Help menu instead of in
an Extra Help cascade menu. Rearrange the Help menu so the Additional
Help Sources come last. Update help.txt appropriately.
- Fix Tk root pop-ups in configSectionNameDialog.py and configDialog.py
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index b940c3b..b9522fc 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -247,8 +247,8 @@ class EditorWindow: menudict[name] = menu = Menu(mbar, name=name) mbar.add_cascade(label=label, menu=menu, underline=underline) self.fill_menus() - #create the ExtraHelp menu, if required - self.ResetExtraHelpMenu() + self.base_helpmenu_length = self.menudict['help'].index(END) + self.reset_help_menu_entries() def postwindowsmenu(self): # Only called when Windows menu exists @@ -315,7 +315,8 @@ class EditorWindow: return "break" def display_docs(self, url): - url = os.path.normpath(url) + if not (url.startswith('www') or url.startswith('http')): + url = os.path.normpath(url) if sys.platform.count('win') or sys.platform.count('nt'): os.startfile(url) else: @@ -530,29 +531,28 @@ class EditorWindow: menu.entryconfig(index,accelerator=accel) #print 'accel now:',accel,'\n' - def ResetExtraHelpMenu(self): - "Load or update the Extra Help menu if required" - menuList=idleConf.GetAllExtraHelpSourcesList() - helpMenu=self.menudict['help'] - cascadeIndex=helpMenu.index(END)-1 - if menuList: - if not hasattr(self,'menuExtraHelp'): - self.menuExtraHelp=Menu(self.menubar) - helpMenu.insert_cascade(cascadeIndex,label='Extra Help', - underline=1,menu=self.menuExtraHelp) - self.menuExtraHelp.delete(1,END) - for menuItem in menuList: - self.menuExtraHelp.add_command(label=menuItem[0], - command=self.__DisplayExtraHelpCallback(menuItem[1])) - else: #no extra help items - if hasattr(self,'menuExtraHelp'): - helpMenu.delete(cascadeIndex-1) - del(self.menuExtraHelp) - - def __DisplayExtraHelpCallback(self,helpFile): - def DisplayExtraHelp(helpFile=helpFile): - self.display_docs(helpFile) - return DisplayExtraHelp + def reset_help_menu_entries(self): + "Update the additional help entries on the Help menu" + help_list = idleConf.GetAllExtraHelpSourcesList() + helpmenu = self.menudict['help'] + # first delete the extra help entries, if any + helpmenu_length = helpmenu.index(END) + if helpmenu_length > self.base_helpmenu_length: + helpmenu.delete((self.base_helpmenu_length + 1), helpmenu_length) + # then rebuild them + if help_list: + helpmenu.add_separator() + for entry in help_list: + cmd = self.__extra_help_callback(entry[1]) + helpmenu.add_command(label=entry[0], command=cmd) + # and update the menu dictionary + self.menudict['help'] = helpmenu + + def __extra_help_callback(self, helpfile): + "Create a callback with the helpfile value frozen at definition time" + def display_extra_help(helpfile=helpfile): + self.display_docs(helpfile) + return display_extra_help def UpdateRecentFilesList(self,newFile=None): "Load or update the recent files list, and menu if required" |