Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Create function to update menu item state.
* Instead of updating menu state directly, create function
  to update the state.
* Change outwin to call function instead of updating menu
  directly.
  • Loading branch information
csabella committed Dec 28, 2018
commit 24357b329b698c47622297c09c4eaafa744bee47
7 changes: 6 additions & 1 deletion Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ def postwindowsmenu(self):
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':
Expand Down
3 changes: 1 addition & 2 deletions Lib/idlelib/outwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def __init__(self, *args):
EditorWindow.__init__(self, *args)
self.text.bind("<<goto-file-line>>", self.goto_file_line)
self.text.unbind("<<toggle-code-context>>")
self.menudict['options'].entryconfig('*Code Context',
state='disabled')
self.update_menu_state('options', '*Code Context', 'disabled')

# Customize EditorWindow
def ispythonsource(self, filename):
Expand Down