From e43e90ec76f935136ec7caca53fc0fc9ff984ed2 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 25 May 2019 16:19:32 -0400 Subject: [PATCH 1/5] bpo-37039: IDLE fixes for zoomheight Move doc entry to match menu. --- Doc/library/idle.rst | 10 +++++----- Lib/idlelib/help.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index c51cf19e97bd05b..bd24695c728233d 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 bc287d637ab7383..228b3195cf92534 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -313,14 +313,14 @@

Options menu (Shell and Editor)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 @@

Navigation



- Last updated on May 19, 2019. + Last updated on May 25, 2019. Found a bug?
From a5374370ac3a9e59188d86d7a9e2a888d13a0d26 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 25 May 2019 16:59:18 -0400 Subject: [PATCH 2/5] On Windows, zoom less to avoid underlapping Win10 taskbar. --- Lib/idlelib/zoomheight.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index 35e285f0ba414be..14c5ce286cfc975 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -28,26 +28,20 @@ def zoom_height(top): return width, height, x, y = map(int, m.groups()) newheight = top.winfo_screenheight() + + # The constants below for Windows and Mac Aqua are visually determined + # to avoid taskbar or menubar and app icons. if sys.platform == 'win32': newy = 0 - newheight = newheight - 72 - + newheight = newheight - 114 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) + + newgeom = ('' if height >= newheight else f"{width}x{newheight}+{x}+{newy}") top.wm_geometry(newgeom) return newgeom != "" From 65fb24251394cdec7f6f6be186901dbeda85324d Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 25 May 2019 17:52:14 -0400 Subject: [PATCH 3/5] More refactoring. --- Lib/idlelib/zoomheight.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index 14c5ce286cfc975..2f3a869df06e7be 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -31,16 +31,10 @@ def zoom_height(top): # The constants below for Windows and Mac Aqua are visually determined # to avoid taskbar or menubar and app icons. - if sys.platform == 'win32': - newy = 0 - newheight = newheight - 114 - elif macosx.isAquaTk(): - newy = 22 - newheight = newheight - newy - 88 - else: - newy = 0 - newheight = newheight - 88 - + newy, bot_y = ((0, 114) 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 != "" From 4d885e37c46c75bb023b84f0311d3017da5c4e64 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 25 May 2019 17:58:02 -0400 Subject: [PATCH 4/5] Delete () not needed for 1 line. --- Lib/idlelib/zoomheight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index 2f3a869df06e7be..f41f1b8a671290d 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -35,7 +35,7 @@ def zoom_height(top): (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}") + newgeom = '' if height >= newheight else f"{width}x{newheight}+{x}+{newy}" top.wm_geometry(newgeom) return newgeom != "" From 62ad3f3ae345417574a5ccef8513263ec6110eea Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 27 May 2019 18:41:48 -0400 Subject: [PATCH 5/5] Revert change only good for my system. --- Lib/idlelib/zoomheight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index f41f1b8a671290d..523f5d51e02fd22 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -31,7 +31,7 @@ def zoom_height(top): # The constants below for Windows and Mac Aqua are visually determined # to avoid taskbar or menubar and app icons. - newy, bot_y = ((0, 114) if sys.platform == 'win32' else + 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