diff -r 2e69ef48601c Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py Thu Oct 23 22:38:46 2014 +0200 +++ b/Lib/idlelib/configDialog.py Sat Oct 25 00:39:52 2014 -0400 @@ -15,13 +15,14 @@ import tkinter.font as tkFont from idlelib.configHandler import idleConf +from idlelib.configHelpSourceEdit import GetHelpSourceDialog +from idlelib.configSectionNameDialog import GetCfgSectionNameDialog from idlelib.dynOptionMenuWidget import DynOptionMenu +from idlelib.keybindingDialog import GetKeysDialog from idlelib.tabbedpages import TabbedPageSet -from idlelib.keybindingDialog import GetKeysDialog -from idlelib.configSectionNameDialog import GetCfgSectionNameDialog -from idlelib.configHelpSourceEdit import GetHelpSourceDialog -from idlelib.tabbedpages import TabbedPageSet +from idlelib.textView import view_text from idlelib import macosxSupport + class ConfigDialog(Toplevel): def __init__(self, parent, title='', _htest=False, _utest=False): @@ -63,12 +64,12 @@ self.resizable(height=FALSE, width=FALSE) self.transient(parent) self.grab_set() - self.protocol("WM_DELETE_WINDOW", self.Cancel) + self.protocol("WM_DELETE_WINDOW", self.cancel) self.tabPages.focus_set() #key bindings for this dialog - #self.bind('', self.Cancel) #dismiss dialog, no save - #self.bind('', self.Apply) #apply changes, save - #self.bind('', self.Help) #context help + #self.bind('', self.cancel) # dismiss dialog, no save + #self.bind('', self.apply) # apply changes, save + #self.bind('', self.help) # context help self.LoadConfigs() self.AttachVarCallbacks() #avoid callbacks during LoadConfigs @@ -94,24 +95,13 @@ paddingArgs = {'padx':6, 'pady':3} outer = Frame(self, pady=2) buttons = Frame(outer, pady=2) - self.buttonOk = Button( - buttons, text='Ok', command=self.Ok, - takefocus=FALSE, **paddingArgs) - self.buttonApply = Button( - buttons, text='Apply', command=self.Apply, - takefocus=FALSE, **paddingArgs) - self.buttonCancel = Button( - buttons, text='Cancel', command=self.Cancel, - takefocus=FALSE, **paddingArgs) - self.buttonOk.pack(side=LEFT, padx=5) - self.buttonApply.pack(side=LEFT, padx=5) - self.buttonCancel.pack(side=LEFT, padx=5) -# Comment out Help button creation and packing until implement self.Help -## self.buttonHelp = Button( -## buttons, text='Help', command=self.Help, -## takefocus=FALSE, **paddingArgs) -## self.buttonHelp.pack(side=RIGHT, padx=5) - + for txt, cmd in ( + ('Ok', self.ok), + ('Apply', self.apply), + ('Cancel', self.cancel), + ('Help', self.help)): + Button(buttons, text=txt, command=cmd, takefocus=FALSE, + **paddingArgs).pack(side=LEFT, padx=5) # add space above buttons Frame(outer, height=2, borderwidth=0).pack(side=TOP) buttons.pack(side=BOTTOM) @@ -767,7 +757,7 @@ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default')) self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.apply() self.SetKeysType() def DeleteCustomTheme(self): @@ -794,7 +784,7 @@ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default')) self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.apply() self.SetThemeType() def GetColour(self): @@ -1174,20 +1164,30 @@ instance.ApplyKeybindings() instance.reset_help_menu_entries() - def Cancel(self): + def ok(self): + self.apply() self.destroy() - def Ok(self): - self.Apply() - self.destroy() - - def Apply(self): + def apply(self): self.DeactivateCurrentConfig() self.SaveAllChangedConfigs() self.ActivateConfigChanges() - def Help(self): - pass + def cancel(self): + self.destroy() + + def help(self): + text = help_common + view_text(self, "Extension Configuration Help", text, modal=False) + +help_common = '''\ +When Idle starts, it uses configparser to read option values from all +pythonxy/Lib/idlelib/config-xyz.def files and all user overrides in +HOME/.idlerc/config-xyz.cfg files. The user files are common to all +versions of Python installed on a machine and only contain values that +are different from the defaults. If you change any values with this +dialog, the corresponding user file will be re-written. +''' class VerticalScrolledFrame(Frame): """A pure Tkinter vertically scrollable frame. @@ -1282,7 +1282,7 @@ self.resizable(height=FALSE, width=FALSE) # don't allow resizing yet self.transient(parent) - self.protocol("WM_DELETE_WINDOW", self.Cancel) + self.protocol("WM_DELETE_WINDOW", self.cancel) self.tabbed_page_set.focus_set() # wait for window to be generated self.update() @@ -1397,16 +1397,17 @@ return - Ok = ConfigDialog.Ok + ok = ConfigDialog.ok - def Apply(self): + def apply(self): self.save_all_changed_configs() pass - Cancel = ConfigDialog.Cancel + cancel = ConfigDialog.cancel - def Help(self): - pass + def help(self): + text = help_common + view_text(self, "Extension Configuration Help", text, modal=False) def set_user_value(self, section, opt): name = opt['name'] diff -r 2e69ef48601c Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py Thu Oct 23 22:38:46 2014 +0200 +++ b/Lib/idlelib/textView.py Sat Oct 25 00:39:52 2014 -0400 @@ -21,9 +21,10 @@ Toplevel.__init__(self, parent) self.configure(borderwidth=5) # place dialog below parent if running htest - self.geometry("=%dx%d+%d+%d" % (625, 500, - parent.winfo_rootx() + 10, - parent.winfo_rooty() + (10 if not _htest else 100))) +# self.geometry("=%dx%d+%d+%d" % (800, 600, + self.geometry("+%d+%d" % ( + parent.winfo_rootx() + 10, + parent.winfo_rooty() + (10 if not _htest else 100))) #elguavas - config placeholders til config stuff completed self.bg = '#ffffff' self.fg = '#000000' @@ -52,7 +53,7 @@ self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, takefocus=FALSE, highlightthickness=0) self.textView = Text(frameText, wrap=WORD, highlightthickness=0, - fg=self.fg, bg=self.bg) + fg=self.fg, bg=self.bg, width=72, height=30) self.scrollbarView.config(command=self.textView.yview) self.textView.config(yscrollcommand=self.scrollbarView.set) self.buttonOk.pack()