1"""Define the menu contents, hotkeys, and event bindings. 2 3There is additional configuration information in the EditorWindow class (and 4subclasses): the menus are created there based on the menu_specs (class) 5variable, and menus not created are silently skipped in the code here. This 6makes it possible, for example, to define a Debug menu which is only present in 7the PythonShell window, and a Format menu which is only present in the Editor 8windows. 9 10""" 11from idlelib.configHandler import idleConf 12 13# Warning: menudefs is altered in macosxSupport.overrideRootMenu() 14# after it is determined that an OS X Aqua Tk is in use, 15# which cannot be done until after Tk() is first called. 16# Do not alter the 'file', 'options', or 'help' cascades here 17# without altering overrideRootMenu() as well. 18# TODO: Make this more robust 19 20menudefs = [ 21 # underscore prefixes character to underscore 22 ('file', [ 23 ('_New File', '<<open-new-window>>'), 24 ('_Open...', '<<open-window-from-file>>'), 25 ('Open _Module...', '<<open-module>>'), 26 ('Class _Browser', '<<open-class-browser>>'), 27 ('_Path Browser', '<<open-path-browser>>'), 28 None, 29 ('_Save', '<<save-window>>'), 30 ('Save _As...', '<<save-window-as-file>>'), 31 ('Save Cop_y As...', '<<save-copy-of-window-as-file>>'), 32 None, 33 ('Prin_t Window', '<<print-window>>'), 34 None, 35 ('_Close', '<<close-window>>'), 36 ('E_xit', '<<close-all-windows>>'), 37 ]), 38 ('edit', [ 39 ('_Undo', '<<undo>>'), 40 ('_Redo', '<<redo>>'), 41 None, 42 ('Cu_t', '<<cut>>'), 43 ('_Copy', '<<copy>>'), 44 ('_Paste', '<<paste>>'), 45 ('Select _All', '<<select-all>>'), 46 None, 47 ('_Find...', '<<find>>'), 48 ('Find A_gain', '<<find-again>>'), 49 ('Find _Selection', '<<find-selection>>'), 50 ('Find in Files...', '<<find-in-files>>'), 51 ('R_eplace...', '<<replace>>'), 52 ('Go to _Line', '<<goto-line>>'), 53 ]), 54('format', [ 55 ('_Indent Region', '<<indent-region>>'), 56 ('_Dedent Region', '<<dedent-region>>'), 57 ('Comment _Out Region', '<<comment-region>>'), 58 ('U_ncomment Region', '<<uncomment-region>>'), 59 ('Tabify Region', '<<tabify-region>>'), 60 ('Untabify Region', '<<untabify-region>>'), 61 ('Toggle Tabs', '<<toggle-tabs>>'), 62 ('New Indent Width', '<<change-indentwidth>>'), 63 ]), 64 ('run', [ 65 ('Python Shell', '<<open-python-shell>>'), 66 ]), 67 ('shell', [ 68 ('_View Last Restart', '<<view-restart>>'), 69 ('_Restart Shell', '<<restart-shell>>'), 70 None, 71 ('_Interrupt Execution', '<<interrupt-execution>>'), 72 ]), 73 ('debug', [ 74 ('_Go to File/Line', '<<goto-file-line>>'), 75 ('!_Debugger', '<<toggle-debugger>>'), 76 ('_Stack Viewer', '<<open-stack-viewer>>'), 77 ('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>'), 78 ]), 79 ('options', [ 80 ('Configure _IDLE', '<<open-config-dialog>>'), 81 None, 82 ]), 83 ('help', [ 84 ('_About IDLE', '<<about-idle>>'), 85 None, 86 ('_IDLE Help', '<<help>>'), 87 ('Python _Docs', '<<python-docs>>'), 88 ]), 89] 90 91default_keydefs = idleConf.GetCurrentKeySet() 92