From 61775c313f6116e627fe837ac5e3e11a3d14eb78 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 28 Dec 2018 10:29:06 -0800 Subject: [PATCH] IDLE: Create function to update menu item state. (GH-11343) This will be needed for other menu items. Change outwin to call the function instead of updating the menu item directly. (cherry picked from commit 804a5d94b6b7f8cb8546112aee2bc3af362f28f5) Co-authored-by: Cheryl Sabella --- Lib/idlelib/editor.py | 7 ++++++- Lib/idlelib/outwin.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index d92b32b24004..f4437668a3ed 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -447,10 +447,15 @@ class EditorWindow(object): window.add_windows_to_menu(menu) def update_menu_label(self, menu, index, label): - "Update label for menu item at index ." + "Update label for menu item at index." menuitem = self.menudict[menu] menuitem.entryconfig(index, label=label) + def update_menu_state(self, menu, index, state): + "Update state for menu item at index." + menuitem = self.menudict[menu] + menuitem.entryconfig(index, state=state) + def handle_yview(self, event, *args): "Handle scrollbar." if event == 'moveto': diff --git a/Lib/idlelib/outwin.py b/Lib/idlelib/outwin.py index f6361eb9aef1..ecc53ef0195d 100644 --- a/Lib/idlelib/outwin.py +++ b/Lib/idlelib/outwin.py @@ -78,8 +78,7 @@ class OutputWindow(EditorWindow): EditorWindow.__init__(self, *args) self.text.bind("<>", self.goto_file_line) self.text.unbind("<>") - self.menudict['options'].entryconfig('*Code Context', - state='disabled') + self.update_menu_state('options', '*Code Context', 'disabled') # Customize EditorWindow def ispythonsource(self, filename): -- 2.47.3