Skip to content

Commit df9b032

Browse files
authored
bpo-37039: IDLE - zoomheight fixes (GH-13576)
Move doc entry to match menu and refactor zoom function. A followup patch will include a blurb.
1 parent cd590a7 commit df9b032

File tree

3 files changed

+18
-30
lines changed

3 files changed

+18
-30
lines changed

Doc/library/idle.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,16 @@ Configure IDLE
281281
menu. For more, see
282282
:ref:`Setting preferences <preferences>` under Help and preferences.
283283

284-
Zoom/Restore Height
285-
Toggles the window between normal size and maximum height. The initial size
286-
defaults to 40 lines by 80 chars unless changed on the General tab of the
287-
Configure IDLE dialog.
288-
289284
Show/Hide Code Context (Editor Window only)
290285
Open a pane at the top of the edit window which shows the block context
291286
of the code which has scrolled above the top of the window. See
292287
:ref:`Code Context <code-context>` in the Editing and Navigation section below.
293288

289+
Zoom/Restore Height
290+
Toggles the window between normal size and maximum height. The initial size
291+
defaults to 40 lines by 80 chars unless changed on the General tab of the
292+
Configure IDLE dialog.
293+
294294
Window menu (Shell and Editor)
295295
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296296

Lib/idlelib/help.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,14 @@ <h3>Options menu (Shell and Editor)<a class="headerlink" href="#options-menu-she
313313
configuration dialog by selecting Preferences in the application
314314
menu. For more, see
315315
<a class="reference internal" href="#preferences"><span class="std std-ref">Setting preferences</span></a> under Help and preferences.</dd>
316-
<dt>Zoom/Restore Height</dt>
317-
<dd>Toggles the window between normal size and maximum height. The initial size
318-
defaults to 40 lines by 80 chars unless changed on the General tab of the
319-
Configure IDLE dialog.</dd>
320316
<dt>Show/Hide Code Context (Editor Window only)</dt>
321317
<dd>Open a pane at the top of the edit window which shows the block context
322318
of the code which has scrolled above the top of the window. See
323319
<a class="reference internal" href="#code-context"><span class="std std-ref">Code Context</span></a> in the Editing and Navigation section below.</dd>
320+
<dt>Zoom/Restore Height</dt>
321+
<dd>Toggles the window between normal size and maximum height. The initial size
322+
defaults to 40 lines by 80 chars unless changed on the General tab of the
323+
Configure IDLE dialog.</dd>
324324
</dl>
325325
</div>
326326
<div class="section" id="window-menu-shell-and-editor">
@@ -943,7 +943,7 @@ <h3>Navigation</h3>
943943
<br />
944944
<br />
945945

946-
Last updated on May 19, 2019.
946+
Last updated on May 25, 2019.
947947
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
948948
<br />
949949

Lib/idlelib/zoomheight.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,14 @@ def zoom_height(top):
2828
return
2929
width, height, x, y = map(int, m.groups())
3030
newheight = top.winfo_screenheight()
31-
if sys.platform == 'win32':
32-
newy = 0
33-
newheight = newheight - 72
34-
35-
elif macosx.isAquaTk():
36-
# The '88' below is a magic number that avoids placing the bottom
37-
# of the window below the panel on my machine. I don't know how
38-
# to calculate the correct value for this with tkinter.
39-
newy = 22
40-
newheight = newheight - newy - 88
41-
42-
else:
43-
#newy = 24
44-
newy = 0
45-
#newheight = newheight - 96
46-
newheight = newheight - 88
47-
if height >= newheight:
48-
newgeom = ""
49-
else:
50-
newgeom = "%dx%d+%d+%d" % (width, newheight, x, newy)
31+
32+
# The constants below for Windows and Mac Aqua are visually determined
33+
# to avoid taskbar or menubar and app icons.
34+
newy, bot_y = ((0, 72) if sys.platform == 'win32' else
35+
(22, 88) if macosx.isAquaTk() else
36+
(0, 88) ) # Guess for anything else.
37+
newheight = newheight - newy - bot_y
38+
newgeom = '' if height >= newheight else f"{width}x{newheight}+{x}+{newy}"
5139
top.wm_geometry(newgeom)
5240
return newgeom != ""
5341

0 commit comments

Comments
 (0)