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