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

Skip to content

Commit 72c3bf0

Browse files
author
Steven M. Gava
committed
changeover to new keybinding configuration implementation
1 parent c628a06 commit 72c3bf0

11 files changed

Lines changed: 50 additions & 109 deletions

Lib/idlelib/AutoExpand.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77

88
class AutoExpand:
99

10-
keydefs = {
11-
'<<expand-word>>': ['<Alt-slash>'],
12-
}
13-
14-
unix_keydefs = {
15-
'<<expand-word>>': ['<Meta-slash>', '<Alt-slash>'],
16-
}
17-
1810
menudefs = [
1911
('edit', [
2012
('E_xpand word', '<<expand-word>>'),

Lib/idlelib/AutoIndent.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class AutoIndent:
4141

4242
menudefs = [
4343
('format', [ # /s/edit/format [email protected]
44-
None,
4544
('_Indent region', '<<indent-region>>'),
4645
('_Dedent region', '<<dedent-region>>'),
4746
('Comment _out region', '<<comment-region>>'),
@@ -53,39 +52,6 @@ class AutoIndent:
5352
]),
5453
]
5554

56-
keydefs = {
57-
'<<smart-backspace>>': ['<Key-BackSpace>'],
58-
'<<newline-and-indent>>': ['<Key-Return>', '<KP_Enter>'],
59-
'<<smart-indent>>': ['<Key-Tab>']
60-
}
61-
62-
windows_keydefs = {
63-
'<<indent-region>>': ['<Control-bracketright>'],
64-
'<<dedent-region>>': ['<Shift-Tab>', # [email protected]
65-
'<Control-bracketleft>'],
66-
'<<comment-region>>': ['<Alt-Key-3>'],
67-
'<<uncomment-region>>': ['<Alt-Key-4>'],
68-
'<<tabify-region>>': ['<Alt-Key-5>'],
69-
'<<untabify-region>>': ['<Alt-Key-6>'],
70-
'<<toggle-tabs>>': ['<Alt-Key-t>'],
71-
'<<change-indentwidth>>': ['<Alt-Key-u>'],
72-
}
73-
74-
unix_keydefs = {
75-
'<<indent-region>>': ['<Alt-bracketright>',
76-
'<Meta-bracketright>',
77-
'<Control-bracketright>'],
78-
'<<dedent-region>>': ['<Alt-bracketleft>',
79-
'<Meta-bracketleft>',
80-
'<Control-bracketleft>'],
81-
'<<comment-region>>': ['<Alt-Key-3>', '<Meta-Key-3>'],
82-
'<<uncomment-region>>': ['<Alt-Key-4>', '<Meta-Key-4>'],
83-
'<<tabify-region>>': ['<Alt-Key-5>', '<Meta-Key-5>'],
84-
'<<untabify-region>>': ['<Alt-Key-6>', '<Meta-Key-6>'],
85-
'<<toggle-tabs>>': ['<Alt-Key-t>'],
86-
'<<change-indentwidth>>': ['<Alt-Key-u>'],
87-
}
88-
8955
# usetabs true -> literal tab characters are used by indent and
9056
# dedent cmds, possibly mixed with spaces if
9157
# indentwidth is not a multiple of tabwidth

Lib/idlelib/Bindings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@
7373
]),
7474
]
7575

76-
default_keydefs = idleConf.GetKeys(keySetName=idleConf.CurrentKeys())
76+
default_keydefs = idleConf.GetCurrentKeySet()
7777

7878
del sys

Lib/idlelib/CallTips.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ class CallTips:
1010
menudefs = [
1111
]
1212

13-
keydefs = {
14-
'<<paren-open>>': ['<Key-parenleft>'],
15-
'<<paren-close>>': ['<Key-parenright>'],
16-
'<<check-calltip-cancel>>': ['<KeyRelease>'],
17-
'<<calltip-cancel>>': ['<ButtonPress>', '<Key-Escape>'],
18-
}
19-
20-
windows_keydefs = {
21-
}
22-
23-
unix_keydefs = {
24-
}
25-
2613
def __init__(self, editwin):
2714
self.editwin = editwin
2815
self.text = editwin.text

Lib/idlelib/EditorWindow.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -590,17 +590,7 @@ def load_extension(self, name):
590590
cls = getattr(mod, name)
591591
ins = cls(self)
592592
self.extensions[name] = ins
593-
kdnames = ["keydefs"]
594-
if sys.platform == 'win32':
595-
kdnames.append("windows_keydefs")
596-
elif sys.platform == 'mac':
597-
kdnames.append("mac_keydefs")
598-
else:
599-
kdnames.append("unix_keydefs")
600-
keydefs = {}
601-
for kdname in kdnames:
602-
if hasattr(ins, kdname):
603-
keydefs.update(getattr(ins, kdname))
593+
keydefs=idleConf.GetExtensionBindings(name)
604594
if keydefs:
605595
self.apply_bindings(keydefs)
606596
for vevent in keydefs.keys():
@@ -612,6 +602,7 @@ def load_extension(self, name):
612602
methodname = methodname + "_event"
613603
if hasattr(ins, methodname):
614604
self.text.bind(vevent, getattr(ins, methodname))
605+
615606
if hasattr(ins, "menudefs"):
616607
self.fill_menus(ins.menudefs, keydefs)
617608
return ins

Lib/idlelib/ExecBinding.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ def loader_connect(client, addr):
4545
protocol.publish('ExecBinding', loader_connect)
4646

4747
class ExecBinding:
48-
keydefs = {
49-
'<<run-complete-script>>': ['<F5>'],
50-
'<<stop-execution>>': ['<Cancel>'], #'<Control-c>'
51-
}
52-
5348
menudefs = [
5449
('run', [None,
5550
('Run program', '<<run-complete-script>>'),

Lib/idlelib/FormatParagraph.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ class FormatParagraph:
2525
])
2626
]
2727

28-
keydefs = {
29-
'<<format-paragraph>>': ['<Alt-q>'],
30-
}
31-
32-
unix_keydefs = {
33-
'<<format-paragraph>>': ['<Meta-q>'],
34-
}
35-
3628
def __init__(self, editwin):
3729
self.editwin = editwin
3830

Lib/idlelib/ParenMatch.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,7 @@ class ParenMatch:
4343
to the right of a right paren. I don't know how to do that in Tk,
4444
so I haven't bothered.
4545
"""
46-
4746
menudefs = []
48-
49-
keydefs = {
50-
'<<flash-open-paren>>' : ('<KeyRelease-parenright>',
51-
'<KeyRelease-bracketright>',
52-
'<KeyRelease-braceright>'),
53-
'<<check-restore>>' : ('<KeyPress>',),
54-
}
55-
56-
windows_keydefs = {}
57-
unix_keydefs = {}
58-
5947
iconf = idleconf.getsection('ParenMatch')
6048
STYLE = iconf.getdef('style', 'default')
6149
FLASH_DELAY = iconf.getint('flash-delay')

Lib/idlelib/ScriptBinding.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535

3636
class ScriptBinding:
3737

38-
keydefs = {
39-
'<<check-module>>': ['<Alt-F5>', '<Meta-F5>'],
40-
'<<import-module>>': ['<F5>'],
41-
'<<run-script>>': ['<Control-F5>'],
42-
}
43-
4438
menudefs = [
4539
('edit', [None,
4640
('Check module', '<<check-module>>'),

Lib/idlelib/ZoomHeight.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ class ZoomHeight:
1010
('_Zoom Height', '<<zoom-height>>'),
1111
])
1212
]
13-
14-
windows_keydefs = {
15-
'<<zoom-height>>': ['<Alt-F2>'],
16-
}
17-
unix_keydefs = {
18-
'<<zoom-height>>': ['<Control-x><Control-z>'],
19-
}
20-
13+
2114
def __init__(self, editwin):
2215
self.editwin = editwin
2316

0 commit comments

Comments
 (0)