ยปCore Development>Code coverage>Lib/idlelib/mainmenu.py

Python code coverage for Lib/idlelib/mainmenu.py

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