From df9b032f47e4edaf306d95449370e565ee470018 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 27 May 2019 19:16:46 -0400 Subject: bpo-37039: IDLE - zoomheight fixes (GH-13576) Move doc entry to match menu and refactor zoom function. A followup patch will include a blurb. --- Doc/library/idle.rst | 10 +++++----- Lib/idlelib/help.html | 10 +++++----- Lib/idlelib/zoomheight.py | 28 ++++++++-------------------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index c51cf19..bd24695 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -281,16 +281,16 @@ Configure IDLE menu. For more, see :ref:`Setting preferences ` under Help and preferences. -Zoom/Restore Height - Toggles the window between normal size and maximum height. The initial size - defaults to 40 lines by 80 chars unless changed on the General tab of the - Configure IDLE dialog. - Show/Hide Code Context (Editor Window only) Open a pane at the top of the edit window which shows the block context of the code which has scrolled above the top of the window. See :ref:`Code Context ` in the Editing and Navigation section below. +Zoom/Restore Height + Toggles the window between normal size and maximum height. The initial size + defaults to 40 lines by 80 chars unless changed on the General tab of the + Configure IDLE dialog. + Window menu (Shell and Editor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index bc287d6..228b319 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -313,14 +313,14 @@ size, additional help sources, and extensions. On macOS, open the configuration dialog by selecting Preferences in the application menu. For more, see Setting preferences under Help and preferences. -
Zoom/Restore Height
-
Toggles the window between normal size and maximum height. The initial size -defaults to 40 lines by 80 chars unless changed on the General tab of the -Configure IDLE dialog.
Show/Hide Code Context (Editor Window only)
Open a pane at the top of the edit window which shows the block context of the code which has scrolled above the top of the window. See Code Context in the Editing and Navigation section below.
+
Zoom/Restore Height
+
Toggles the window between normal size and maximum height. The initial size +defaults to 40 lines by 80 chars unless changed on the General tab of the +Configure IDLE dialog.
@@ -943,7 +943,7 @@ also used for testing.



- Last updated on May 19, 2019. + Last updated on May 25, 2019. Found a bug?
diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index 35e285f..523f5d5 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -28,26 +28,14 @@ def zoom_height(top): return width, height, x, y = map(int, m.groups()) newheight = top.winfo_screenheight() - if sys.platform == 'win32': - newy = 0 - newheight = newheight - 72 - - elif macosx.isAquaTk(): - # The '88' below is a magic number that avoids placing the bottom - # of the window below the panel on my machine. I don't know how - # to calculate the correct value for this with tkinter. - newy = 22 - newheight = newheight - newy - 88 - - else: - #newy = 24 - newy = 0 - #newheight = newheight - 96 - newheight = newheight - 88 - if height >= newheight: - newgeom = "" - else: - newgeom = "%dx%d+%d+%d" % (width, newheight, x, newy) + + # The constants below for Windows and Mac Aqua are visually determined + # to avoid taskbar or menubar and app icons. + newy, bot_y = ((0, 72) if sys.platform == 'win32' else + (22, 88) if macosx.isAquaTk() else + (0, 88) ) # Guess for anything else. + newheight = newheight - newy - bot_y + newgeom = '' if height >= newheight else f"{width}x{newheight}+{x}+{newy}" top.wm_geometry(newgeom) return newgeom != "" -- cgit v0.12