<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">"""Define the menu contents, hotkeys, and event bindings.

There is additional configuration information in the EditorWindow class (and
subclasses): the menus are created there based on the menu_specs (class)
variable, and menus not created are silently skipped in the code here.  This
makes it possible, for example, to define a Debug menu which is only present in
the PythonShell window, and a Format menu which is only present in the Editor
windows.

"""
from importlib.util import find_spec

from idlelib.config import idleConf

#   Warning: menudefs is altered in macosx.overrideRootMenu()
#   after it is determined that an OS X Aqua Tk is in use,
#   which cannot be done until after Tk() is first called.
#   Do not alter the 'file', 'options', or 'help' cascades here
#   without altering overrideRootMenu() as well.
#       TODO: Make this more robust

menudefs = [
 # underscore prefixes character to underscore
 ('file', [
   ('_New File', '&lt;&lt;open-new-window&gt;&gt;'),
   ('_Open...', '&lt;&lt;open-window-from-file&gt;&gt;'),
   ('Open _Module...', '&lt;&lt;open-module&gt;&gt;'),
   ('Module _Browser', '&lt;&lt;open-class-browser&gt;&gt;'),
   ('_Path Browser', '&lt;&lt;open-path-browser&gt;&gt;'),
   None,
   ('_Save', '&lt;&lt;save-window&gt;&gt;'),
   ('Save _As...', '&lt;&lt;save-window-as-file&gt;&gt;'),
   ('Save Cop_y As...', '&lt;&lt;save-copy-of-window-as-file&gt;&gt;'),
   None,
   ('Prin_t Window', '&lt;&lt;print-window&gt;&gt;'),
   None,
   ('_Close Window', '&lt;&lt;close-window&gt;&gt;'),
   ('E_xit IDLE', '&lt;&lt;close-all-windows&gt;&gt;'),
   ]),

 ('edit', [
   ('_Undo', '&lt;&lt;undo&gt;&gt;'),
   ('_Redo', '&lt;&lt;redo&gt;&gt;'),
   None,
   ('Select _All', '&lt;&lt;select-all&gt;&gt;'),
   ('Cu_t', '&lt;&lt;cut&gt;&gt;'),
   ('_Copy', '&lt;&lt;copy&gt;&gt;'),
   ('_Paste', '&lt;&lt;paste&gt;&gt;'),
   None,
   ('_Find...', '&lt;&lt;find&gt;&gt;'),
   ('Find A_gain', '&lt;&lt;find-again&gt;&gt;'),
   ('Find _Selection', '&lt;&lt;find-selection&gt;&gt;'),
   ('Find in Files...', '&lt;&lt;find-in-files&gt;&gt;'),
   ('R_eplace...', '&lt;&lt;replace&gt;&gt;'),
   None,
   ('Go to _Line', '&lt;&lt;goto-line&gt;&gt;'),
   ('S_how Completions', '&lt;&lt;force-open-completions&gt;&gt;'),
   ('E_xpand Word', '&lt;&lt;expand-word&gt;&gt;'),
   ('Show C_all Tip', '&lt;&lt;force-open-calltip&gt;&gt;'),
   ('Show Surrounding P_arens', '&lt;&lt;flash-paren&gt;&gt;'),
   ]),

 ('format', [
   ('F_ormat Paragraph', '&lt;&lt;format-paragraph&gt;&gt;'),
   ('_Indent Region', '&lt;&lt;indent-region&gt;&gt;'),
   ('_Dedent Region', '&lt;&lt;dedent-region&gt;&gt;'),
   ('Comment _Out Region', '&lt;&lt;comment-region&gt;&gt;'),
   ('U_ncomment Region', '&lt;&lt;uncomment-region&gt;&gt;'),
   ('Tabify Region', '&lt;&lt;tabify-region&gt;&gt;'),
   ('Untabify Region', '&lt;&lt;untabify-region&gt;&gt;'),
   ('Toggle Tabs', '&lt;&lt;toggle-tabs&gt;&gt;'),
   ('New Indent Width', '&lt;&lt;change-indentwidth&gt;&gt;'),
   ('S_trip Trailing Whitespace', '&lt;&lt;do-rstrip&gt;&gt;'),
   ]),

 ('run', [
   ('R_un Module', '&lt;&lt;run-module&gt;&gt;'),
   ('Run... _Customized', '&lt;&lt;run-custom&gt;&gt;'),
   ('C_heck Module', '&lt;&lt;check-module&gt;&gt;'),
   ('Python Shell', '&lt;&lt;open-python-shell&gt;&gt;'),
   ]),

 ('shell', [
   ('_View Last Restart', '&lt;&lt;view-restart&gt;&gt;'),
   ('_Restart Shell', '&lt;&lt;restart-shell&gt;&gt;'),
   None,
   ('_Previous History', '&lt;&lt;history-previous&gt;&gt;'),
   ('_Next History', '&lt;&lt;history-next&gt;&gt;'),
   None,
   ('_Interrupt Execution', '&lt;&lt;interrupt-execution&gt;&gt;'),
   ]),

 ('debug', [
   ('_Go to File/Line', '&lt;&lt;goto-file-line&gt;&gt;'),
   ('!_Debugger', '&lt;&lt;toggle-debugger&gt;&gt;'),
   ('_Stack Viewer', '&lt;&lt;open-stack-viewer&gt;&gt;'),
   ('!_Auto-open Stack Viewer', '&lt;&lt;toggle-jit-stack-viewer&gt;&gt;'),
   ]),

 ('options', [
   ('Configure _IDLE', '&lt;&lt;open-config-dialog&gt;&gt;'),
   None,
   ('Show _Code Context', '&lt;&lt;toggle-code-context&gt;&gt;'),
   ('Show _Line Numbers', '&lt;&lt;toggle-line-numbers&gt;&gt;'),
   ('_Zoom Height', '&lt;&lt;zoom-height&gt;&gt;'),
   ]),

 ('window', [
   ]),

 ('help', [
   ('_About IDLE', '&lt;&lt;about-idle&gt;&gt;'),
   None,
   ('_IDLE Doc', '&lt;&lt;help&gt;&gt;'),
   ('Python _Docs', '&lt;&lt;python-docs&gt;&gt;'),
   ]),
]

if find_spec('turtledemo'):
    menudefs[-1][1].append(('Turtle Demo', '&lt;&lt;open-turtle-demo&gt;&gt;'))

default_keydefs = idleConf.GetCurrentKeySet()

if __name__ == '__main__':
    from unittest import main
    main('idlelib.idle_test.test_mainmenu', verbosity=2)
</pre></body></html>