Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d0cadba

Browse files
committed
Issue #22726: Re-activate config dialog help button with some content about
the other buttons and the new IDLE Dark theme.
1 parent 1fdc80b commit d0cadba

2 files changed

Lines changed: 33 additions & 20 deletions

File tree

Lib/idlelib/configDialog.py

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from idlelib.configSectionNameDialog import GetCfgSectionNameDialog
2121
from idlelib.configHelpSourceEdit import GetHelpSourceDialog
2222
from idlelib.tabbedpages import TabbedPageSet
23+
from idlelib.textView import view_text
2324
from idlelib import macosxSupport
25+
2426
class 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

11881201
class VerticalScrolledFrame(Frame):
11891202
"""A pure Tkinter vertically scrollable frame.

Lib/idlelib/textView.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, parent, title, text, modal=True, _htest=False):
2121
Toplevel.__init__(self, parent)
2222
self.configure(borderwidth=5)
2323
# place dialog below parent if running htest
24-
self.geometry("=%dx%d+%d+%d" % (625, 500,
24+
self.geometry("=%dx%d+%d+%d" % (750, 500,
2525
parent.winfo_rootx() + 10,
2626
parent.winfo_rooty() + (10 if not _htest else 100)))
2727
#elguavas - config placeholders til config stuff completed

0 commit comments

Comments
 (0)