self.flist = flist
root = root or flist.root
self.root = root
- if flist:
- self.vars = flist.vars
self.menubar = Menu(root)
self.top = top = self.Toplevel(root, menu=self.menubar)
- #self.top.instanceDict makes flist.inversedict avalable to
- #configDialog.py so it can access all EditorWindow instaces
- self.top.instanceDict=flist.inversedict
+ if flist:
+ self.vars = flist.vars
+ #self.top.instanceDict makes flist.inversedict avalable to
+ #configDialog.py so it can access all EditorWindow instaces
+ self.top.instanceDict=flist.inversedict
self.vbar = vbar = Scrollbar(top, name='vbar')
self.text_frame = text_frame = Frame(top)
self.text = text = Text(text_frame, name='text', padx=5, wrap=None,
if self.extensions.has_key('AutoIndent'):
self.extensions['AutoIndent'].set_indentation_params(
self.ispythonsource(filename))
-
+
def set_status_bar(self):
self.status_bar = self.MultiStatusBar(self.top)
self.status_bar.set_label('column', 'Col: ?', side=RIGHT)
menudict[name] = menu = Menu(mbar, name=name)
mbar.add_cascade(label=label, menu=menu, underline=underline)
self.fill_menus()
+ self.ResetExtraHelpMenu()
def postwindowsmenu(self):
# Only called when Windows menu exists
del fn
def python_docs(self, event=None):
- webbrowser.open(self.help_url)
+ self.display_docs(self.help_url)
+
+ def display_docs(self, url):
+ webbrowser.open(url)
def select_all(self, event=None):
self.text.tag_add("sel", "1.0", "end-1c")
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=lambda:self.display_docs(menuItem[1]))
+ else: #no extra help items
+ if hasattr(self,'menuExtraHelp'):
+ helpMenu.delete(cascadeIndex-1)
+ del(self.menuExtraHelp)
+
def saved_change_hook(self):
short = self.short_title()
long = self.long_title()
width=8,command=self.HelpListItemAdd)
self.buttonHelpListRemove=Button(frameHelpListButtons,text='Remove',
state=DISABLED,width=8,command=self.HelpListItemRemove)
- checkHelpBrowser=Checkbutton(frameHelp,variable=self.userHelpBrowser,
- onvalue=1,offvalue=0,text='user specified (html) help browser:',
- command=self.OnCheckUserHelpBrowser)
- self.entryHelpBrowser=Entry(frameHelp,textvariable=self.helpBrowser,
- width=40)
+ # the following is better handled by the BROWSER environment
+ # variable under unix/linux
+ #checkHelpBrowser=Checkbutton(frameHelp,variable=self.userHelpBrowser,
+ # onvalue=1,offvalue=0,text='user specified (html) help browser:',
+ # command=self.OnCheckUserHelpBrowser)
+ #self.entryHelpBrowser=Entry(frameHelp,textvariable=self.helpBrowser,
+ # width=40)
#widget packing
#body
frameRun.pack(side=TOP,padx=5,pady=5,fill=X)
self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5)
self.buttonHelpListAdd.pack(side=TOP,anchor=W)
self.buttonHelpListRemove.pack(side=TOP,anchor=W,pady=5)
- checkHelpBrowser.pack(side=TOP,anchor=W,padx=5)
- self.entryHelpBrowser.pack(side=TOP,anchor=W,padx=5,pady=5)
+ #checkHelpBrowser.pack(side=TOP,anchor=W,padx=5)
+ #self.entryHelpBrowser.pack(side=TOP,anchor=W,padx=5,pady=5)
return frame
def AttachVarCallbacks(self):
def HelpListItemEdit(self):
itemIndex=self.listHelp.index(ANCHOR)
helpSource=self.userHelpList[itemIndex]
- newHelpSource=GetHelpSourceDialog(self,'New Help Source',
+ newHelpSource=GetHelpSourceDialog(self,'Edit Help Source',
menuItem=helpSource[0],filePath=helpSource[1]).result
if (not newHelpSource) or (newHelpSource==helpSource):
return #no changes
for helpItem in self.userHelpList:
self.listHelp.insert(END,helpItem[0]+' '+helpItem[1])
self.SetHelpListButtonStates()
- self.userHelpBrowser.set(idleConf.GetOption('main','General',
- 'user-help-browser',default=0,type='bool'))
- self.helpBrowser.set(idleConf.GetOption('main','General',
- 'user-help-browser-command',default=''))
- self.OnCheckUserHelpBrowser()
+ #self.userHelpBrowser.set(idleConf.GetOption('main','General',
+ # 'user-help-browser',default=0,type='bool'))
+ #self.helpBrowser.set(idleConf.GetOption('main','General',
+ # 'user-help-browser-command',default=''))
+ #self.OnCheckUserHelpBrowser()
def LoadConfigs(self):
"""
"""
save all configuration changes to user config files.
"""
- if self.changedItems['main'].has_key('HelpFiles'):
- #this section gets completely replaced
- idleConf.userCfg['main'].remove_section('HelpFiles')
+ #if self.changedItems['main'].has_key('HelpFiles'):
+ #this section gets completely replaced
+ print idleConf.GetAllExtraHelpSourcesList()
+ idleConf.userCfg['main'].remove_section('HelpFiles')
+ idleConf.userCfg['main'].Save()
+ print idleConf.GetAllExtraHelpSourcesList()
for configType in self.changedItems.keys():
cfgTypeHasChanges=0
for section in self.changedItems[configType].keys():
if self.SetUserValue(configType,section,item,value):
cfgTypeHasChanges=1
if cfgTypeHasChanges:
+ print configType,'- changed'
idleConf.userCfg[configType].Save()
self.ResetChangedItems() #clear the changed items dict
instance.ResetColorizer()
instance.ResetFont()
instance.ResetKeybindings()
+ instance.ResetExtraHelpMenu()
def Cancel(self):
self.destroy()