2020from idlelib .configSectionNameDialog import GetCfgSectionNameDialog
2121from idlelib .configHelpSourceEdit import GetHelpSourceDialog
2222from idlelib .tabbedpages import TabbedPageSet
23+ from idlelib .textView import view_text
2324from idlelib import macosxSupport
25+
2426class ConfigDialog (Toplevel ):
2527
2628 def __init__ (self , parent , title = '' , _htest = False , _utest = False ):
@@ -85,6 +87,7 @@ def CreateWidgets(self):
8587 self .CreatePageKeys ()
8688 self .CreatePageGeneral ()
8789 self .create_action_buttons ().pack (side = BOTTOM )
90+
8891 def create_action_buttons (self ):
8992 if macosxSupport .isAquaTk ():
9093 # Changing the default padding on OSX results in unreadable
@@ -94,28 +97,18 @@ def create_action_buttons(self):
9497 paddingArgs = {'padx' :6 , 'pady' :3 }
9598 outer = Frame (self , pady = 2 )
9699 buttons = Frame (outer , pady = 2 )
97- self .buttonOk = Button (
98- buttons , text = 'Ok' , command = self .Ok ,
99- takefocus = FALSE , ** paddingArgs )
100- self .buttonApply = Button (
101- buttons , text = 'Apply' , command = self .Apply ,
102- takefocus = FALSE , ** paddingArgs )
103- self .buttonCancel = Button (
104- buttons , text = 'Cancel' , command = self .Cancel ,
105- takefocus = FALSE , ** paddingArgs )
106- self .buttonOk .pack (side = LEFT , padx = 5 )
107- self .buttonApply .pack (side = LEFT , padx = 5 )
108- self .buttonCancel .pack (side = LEFT , padx = 5 )
109- # Comment out Help button creation and packing until implement self.Help
110- ## self.buttonHelp = Button(
111- ## buttons, text='Help', command=self.Help,
112- ## takefocus=FALSE, **paddingArgs)
113- ## self.buttonHelp.pack(side=RIGHT, padx=5)
114-
100+ for txt , cmd in (
101+ ('Ok' , self .Ok ),
102+ ('Apply' , self .Apply ),
103+ ('Cancel' , self .Cancel ),
104+ ('Help' , self .Help )):
105+ Button (buttons , text = txt , command = cmd , takefocus = FALSE ,
106+ ** paddingArgs ).pack (side = LEFT , padx = 5 )
115107 # add space above buttons
116108 Frame (outer , height = 2 , borderwidth = 0 ).pack (side = TOP )
117109 buttons .pack (side = BOTTOM )
118110 return outer
111+
119112 def CreatePageFontTab (self ):
120113 parent = self .parent
121114 self .fontSize = StringVar (parent )
@@ -1183,7 +1176,27 @@ def Apply(self):
11831176 self .ActivateConfigChanges ()
11841177
11851178 def Help (self ):
1186- pass
1179+ page = self .tabPages ._current_page
1180+ view_text (self , title = 'Help for IDLE preferences' ,
1181+ text = help_common + help_pages .get (page , '' ))
1182+
1183+ help_common = '''\
1184+ When you click either the Apply or Ok buttons, settings in this
1185+ dialog that are different from IDLE's default are saved in
1186+ a .idlerc directory in your home directory. Except as noted,
1187+ hese changes apply to all versions of IDLE installed on this
1188+ machine. Some do not take affect until IDLE is restarted.
1189+ [Cancel] only cancels changes made since the last save.
1190+ '''
1191+ help_pages = {
1192+ 'Highlighting' :'''
1193+ Highlighting:
1194+ The IDLE Dark color theme is new in Octover 2015. It can only
1195+ be used with older IDLE releases if it is saved as a custom
1196+ theme, with a different name.
1197+ '''
1198+ }
1199+
11871200
11881201class VerticalScrolledFrame (Frame ):
11891202 """A pure Tkinter vertically scrollable frame.
0 commit comments