Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
IDLE support for maximising editor windows on load
Changes as per PEP 23937
  • Loading branch information
E-Paine authored Apr 30, 2020
commit 31a8f46b4725535304556163bee5c2f6a312d8a9
1 change: 1 addition & 0 deletions Lib/idlelib/config-main.def
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ print-command-win=start /min notepad /p %%s
delete-exitfunc= 1

[EditorWindow]
max= 0
width= 80
height= 40
cursor-blink= 1
Expand Down
17 changes: 16 additions & 1 deletion Lib/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,8 @@ def create_page_general(self):
# Integer values need StringVar because int('') raises.
self.startup_edit = tracers.add(
IntVar(self), ('main', 'General', 'editor-on-startup'))
self.win_max = tracers.add(
BooleanVar(self), ('main', 'EditorWindow', 'max'))
self.win_width = tracers.add(
StringVar(self), ('main', 'EditorWindow', 'width'))
self.win_height = tracers.add(
Expand Down Expand Up @@ -1915,6 +1917,8 @@ def create_page_general(self):
frame_win_size = Frame(frame_window, borderwidth=0)
win_size_title = Label(
frame_win_size, text='Initial Window Size (in characters)')
win_max_title = Checkbutton(frame_win_size, text='Maximised', variable=self.win_max)
self.win_max.trace("w", lambda a, b, c: self.toggle_entry_mode())
win_width_title = Label(frame_win_size, text='Width')
self.win_width_int = Entry(
frame_win_size, textvariable=self.win_width, width=3,
Expand Down Expand Up @@ -2030,7 +2034,8 @@ def create_page_general(self):
self.startup_editor_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
# frame_win_size.
frame_win_size.pack(side=TOP, padx=5, pady=0, fill=X)
win_size_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
win_size_title.pack(side=LEFT, anchor=NW, padx=5, pady=5)
win_max_title.pack(side=TOP, anchor=E, padx=10, pady=5)
self.win_height_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
win_height_title.pack(side=RIGHT, anchor=E, pady=5)
self.win_width_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
Expand Down Expand Up @@ -2089,6 +2094,8 @@ def load_general_cfg(self):
# Set variables for all windows.
self.startup_edit.set(idleConf.GetOption(
'main', 'General', 'editor-on-startup', type='bool'))
self.win_max.set(idleConf.GetOption(
'main', 'EditorWindow', 'max', type='bool'))
self.win_width.set(idleConf.GetOption(
'main', 'EditorWindow', 'width', type='int'))
self.win_height.set(idleConf.GetOption(
Expand Down Expand Up @@ -2125,6 +2132,14 @@ def load_general_cfg(self):
self.helplist.insert(END, help_item[0])
self.set_add_delete_state()

def toggle_entry_mode(self):
if self.win_max.get():
state = "disabled"
else:
state = "normal"
self.win_width_int.config(state=state)
self.win_height_int.config(state=state)

def help_source_selected(self, event):
"Handle event for selecting additional help."
self.set_add_delete_state()
Expand Down
2 changes: 2 additions & 0 deletions Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
self.root = root
self.menubar = Menu(root)
self.top = top = window.ListedToplevel(root, menu=self.menubar)
self.top.attributes('-zoomed', idleConf.GetOption(
'main', 'EditorWindow', 'max', type='bool'))
if flist:
self.tkinter_vars = flist.vars
#self.top.instance_dict makes flist.inversedict available to
Expand Down