From 5ba265cbd3893d74ddb852b2bccb18ed8bb6abab Mon Sep 17 00:00:00 2001 From: Xiaokang2022 <2951256653@qq.com> Date: Sat, 9 Nov 2024 01:57:13 +0800 Subject: [PATCH 1/3] fix: restore menu "Shell", and disable two submenus when using "-n" --- Lib/idlelib/pyshell.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index e882c6cb3b8d19..8163e6b8a654ef 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -875,10 +875,9 @@ class PyShell(OutputWindow): from idlelib.sidebar import ShellSidebar def __init__(self, flist=None): - if use_subprocess: - ms = self.menu_specs - if ms[2][0] != "shell": - ms.insert(2, ("shell", "She_ll")) + ms = self.menu_specs + if ms[2][0] != "shell": + ms.insert(2, ("shell", "She_ll")) self.interp = ModifiedInterpreter(self) if flist is None: root = Tk() @@ -952,6 +951,10 @@ def __init__(self, flist=None): self.text.insert = self.per.top.insert self.per.insertfilter(UserInputTaggingDelegator()) + if not use_subprocess: + self.update_menu_state("shell", 0, "disabled") + self.update_menu_state("shell", 1, "disabled") + def ResetFont(self): super().ResetFont() From 7467b2486c7492ee29ef9ad9f743b275cd1effad Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:07:14 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst diff --git a/Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst b/Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst new file mode 100644 index 00000000000000..8536e38b54aa1b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst @@ -0,0 +1 @@ +fix IDLE: no Shell menu item in single-process mode. From a3e093f4299f4f7cc773b3de1db3d93b8baaefac Mon Sep 17 00:00:00 2001 From: Zhikang Yan <2951256653@qq.com> Date: Fri, 2 May 2025 23:18:36 +0800 Subject: [PATCH 3/3] feat: add a comment for clarity. --- Lib/idlelib/pyshell.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 8163e6b8a654ef..74db9f7317f0bb 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -952,6 +952,7 @@ def __init__(self, flist=None): self.per.insertfilter(UserInputTaggingDelegator()) if not use_subprocess: + # Menu options "View Last Restart" and "Restart Shell" are disabled self.update_menu_state("shell", 0, "disabled") self.update_menu_state("shell", 1, "disabled")