Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4cc5ef5

Browse files
committed
M Bindings.py
M PyShell.py M config-keys.def M configHandler.py 1. Clear any un-entered characters from input line before printing the restart boundary. 2. Restore the Debug menu: There are now both Shell and Debug menus. 3. Add Control-F6 keybinding to Restart Shell. 4. Clarify PyShell.cancel_check() comment. 5. Update doc string for Bindings.py and re-format the file slightly.
1 parent 374c435 commit 4cc5ef5

4 files changed

Lines changed: 34 additions & 24 deletions

File tree

Lib/idlelib/Bindings.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# This file defines the menu contents and key bindings. Note that
2-
# there is additional configuration information in the EditorWindow
3-
# class (and subclasses): the menus are created there based on the
4-
# menu_specs (class) variable, and menus not created are silently
5-
# skipped by the code here. This makes it possible to define the
6-
# Debug menu here, which is only present in the PythonShell window.
1+
"""Define the menu contents, hotkeys, and event bindings.
72
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+
"""
811
import sys
912
from configHandler import idleConf
1013

@@ -43,39 +46,40 @@
4346
('Go to _Line', '<<goto-line>>'),
4447
]),
4548
('format', [
46-
('_Indent Region', '<<indent-region>>'),
47-
('_Dedent Region', '<<dedent-region>>'),
48-
('Comment _Out Region', '<<comment-region>>'),
49-
('U_ncomment Region', '<<uncomment-region>>'),
50-
('Tabify Region', '<<tabify-region>>'),
51-
('Untabify Region', '<<untabify-region>>'),
52-
('Toggle Tabs', '<<toggle-tabs>>'),
53-
('New Indent Width', '<<change-indentwidth>>'),
54-
]),
55-
('run',[
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', [
5659
('Python Shell', '<<open-python-shell>>'),
57-
]),
60+
]),
5861
('shell', [
5962
('_View Last Restart', '<<view-restart>>'),
6063
('_Restart Shell', '<<restart-shell>>'),
61-
None,
64+
]),
65+
('debug', [
6266
('_Go to File/Line', '<<goto-file-line>>'),
6367
('!_Debugger', '<<toggle-debugger>>'),
6468
('_Stack Viewer', '<<open-stack-viewer>>'),
65-
('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>' ),
66-
]),
69+
('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>'),
70+
]),
6771
('options', [
6872
('_Configure IDLE...', '<<open-config-dialog>>'),
6973
None,
7074
('Revert to _Default Settings', '<<revert-all-settings>>'),
71-
]),
75+
]),
7276
('help', [
7377
('_About IDLE', '<<about-idle>>'),
7478
('IDLE _Readme', '<<view-readme>>'),
7579
None,
7680
('_IDLE Help', '<<help>>'),
7781
('Python _Docs', '<<python-docs>>'),
78-
]),
82+
]),
7983
]
8084

8185
default_keydefs = idleConf.GetCurrentKeySet()

Lib/idlelib/PyShell.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ def restart_subprocess(self):
368368
self.transfer_path()
369369
# annotate restart in shell window and mark it
370370
console = self.tkconsole
371+
console.text.delete("iomark", "end-1c")
371372
halfbar = ((int(console.width) - 16) // 2) * '='
372373
console.write(halfbar + ' RESTART ' + halfbar)
373374
console.text.mark_set("restart", "end-1c")
@@ -659,6 +660,7 @@ class PyShell(OutputWindow):
659660
("file", "_File"),
660661
("edit", "_Edit"),
661662
("shell", "_Shell"),
663+
("debug", "_Debug"),
662664
("options", "_Options"),
663665
("windows", "_Windows"),
664666
("help", "_Help"),
@@ -1007,8 +1009,8 @@ def cancel_check(self, frame, what, args,
10071009
# Hack -- use the debugger hooks to be able to handle events
10081010
# and interrupt execution at any time.
10091011
# This slows execution down quite a bit, so you may want to
1010-
# disable this (by not calling settrace() in runcode() above)
1011-
# for full-bore (uninterruptable) speed.
1012+
# disable this (by not calling settrace() in beginexecuting() and
1013+
# endexecuting() for full-bore (uninterruptable) speed.)
10121014
# XXX This should become a user option.
10131015
if self.canceled:
10141016
return

Lib/idlelib/config-keys.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ history-next=<Alt-Key-n> <Meta-Key-n>
2323
history-previous=<Alt-Key-p> <Meta-Key-p>
2424
interrupt-execution=<Control-Key-c>
2525
view-restart=<Key-F6>
26+
restart-shell=<Control-Key-F6>
2627
open-class-browser=<Alt-Key-c> <Meta-Key-c>
2728
open-module=<Alt-Key-m> <Meta-Key-m>
2829
open-new-window=<Control-Key-n>
@@ -69,6 +70,7 @@ history-next=<Alt-Key-n> <Meta-Key-n>
6970
history-previous=<Alt-Key-p> <Meta-Key-p>
7071
interrupt-execution=<Control-Key-c>
7172
view-restart=<Key-F6>
73+
restart-shell=<Control-Key-F6>
7274
open-class-browser=<Control-Key-x><Control-Key-b>
7375
open-module=<Control-Key-x><Control-Key-m>
7476
open-new-window=<Control-Key-x><Control-Key-n>
@@ -119,6 +121,7 @@ history-next=<Control-Key-n>
119121
history-previous=<Control-Key-p>
120122
interrupt-execution=<Control-Key-c>
121123
view-restart=<Key-F6>
124+
restart-shell=<Control-Key-F6>
122125
open-class-browser=<Command-Key-b>
123126
open-module=<Command-Key-m>
124127
open-new-window=<Command-Key-n>

Lib/idlelib/configHandler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ def GetCoreKeys(self, keySetName=None):
522522
'<<history-previous>>': ['<Alt-p>'],
523523
'<<interrupt-execution>>': ['<Control-c>'],
524524
'<<view-restart>>': ['<F6>'],
525+
'<<restart-shell>>': ['<Control-F6>'],
525526
'<<open-class-browser>>': ['<Alt-c>'],
526527
'<<open-module>>': ['<Alt-m>'],
527528
'<<open-new-window>>': ['<Control-n>'],

0 commit comments

Comments
 (0)