summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/config.py
diff options
context:
space:
mode:
authorwohlganger <charles.wohlganger@gmail.com>2017-09-10 21:19:47 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2017-09-10 21:19:47 (GMT)
commit58fc71c447049d0efe4e11db1b55edc307f1bede (patch)
tree237891f31c741848809fa8dab7b6652849f37fa0 /Lib/idlelib/config.py
parentd39dbf4cf18488beb190ab358b7ab38792cd5043 (diff)
downloadcpython-58fc71c447049d0efe4e11db1b55edc307f1bede.zip
cpython-58fc71c447049d0efe4e11db1b55edc307f1bede.tar.gz
cpython-58fc71c447049d0efe4e11db1b55edc307f1bede.tar.bz2
bpo-27099: IDLE - Convert built-in extensions to regular features (#2494)
About 10 IDLE features were implemented as supposedly optional extensions. Their different behavior could be confusing or worse for users and not good for maintenance. Hence the conversion. The main difference for users is that user configurable key bindings for builtin features are now handled uniformly. Now, editing a binding in a keyset only affects its value in the keyset. All bindings are defined together in the system-specific default keysets in config- extensions.def. All custom keysets are saved as a whole in config- extension.cfg. All take effect as soon as one clicks Apply or Ok. The affected events are '<<force-open-completions>>', '<<expand-word>>', '<<force-open-calltip>>', '<<flash-paren>>', '<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and '<<zoom-height>>'. Any (global) customizations made before 3.6.3 will not affect their keyset- specific customization after 3.6.3. and vice versa. Inital patch by Charles Wohlganger, revised by Terry Jan Reedy.
Diffstat (limited to 'Lib/idlelib/config.py')
-rw-r--r--Lib/idlelib/config.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py
index 63d9a44..c3e57bc 100644
--- a/Lib/idlelib/config.py
+++ b/Lib/idlelib/config.py
@@ -359,7 +359,8 @@ class IdleConf:
'stderr-foreground':'#000000',
'stderr-background':'#ffffff',
'console-foreground':'#000000',
- 'console-background':'#ffffff' }
+ 'console-background':'#ffffff',
+ }
for element in theme:
if not cfgParser.has_option(themeName, element):
# Print warning that will return a default color
@@ -443,6 +444,11 @@ class IdleConf:
for extn in userExtns:
if extn not in extns: #user has added own extension
extns.append(extn)
+ for extn in ('AutoComplete','CodeContext',
+ 'FormatParagraph','ParenMatch'):
+ extns.remove(extn)
+ # specific exclusions because we are storing config for mainlined old
+ # extensions in config-extensions.def for backward compatibility
if active_only:
activeExtns = []
for extn in extns:
@@ -594,7 +600,12 @@ class IdleConf:
return ('<<'+virtualEvent+'>>') in self.GetCoreKeys()
# TODO make keyBindins a file or class attribute used for test above
-# and copied in function below
+# and copied in function below.
+
+ former_extension_events = { # Those with user-configurable keys.
+ '<<force-open-completions>>', '<<expand-word>>',
+ '<<force-open-calltip>>', '<<flash-paren>>', '<<format-paragraph>>',
+ '<<run-module>>', '<<check-module>>', '<<zoom-height>>'}
def GetCoreKeys(self, keySetName=None):
"""Return dict of core virtual-key keybindings for keySetName.
@@ -654,8 +665,17 @@ class IdleConf:
'<<toggle-tabs>>': ['<Alt-Key-t>'],
'<<change-indentwidth>>': ['<Alt-Key-u>'],
'<<del-word-left>>': ['<Control-Key-BackSpace>'],
- '<<del-word-right>>': ['<Control-Key-Delete>']
+ '<<del-word-right>>': ['<Control-Key-Delete>'],
+ '<<force-open-completions>>': ['<Control-Key-space>'],
+ '<<expand-word>>': ['<Alt-Key-slash>'],
+ '<<force-open-calltip>>': ['<Control-Key-backslash>'],
+ '<<flash-paren>>': ['<Control-Key-0>'],
+ '<<format-paragraph>>': ['<Alt-Key-q>'],
+ '<<run-module>>': ['<Key-F5>'],
+ '<<check-module>>': ['<Alt-Key-x>'],
+ '<<zoom-height>>': ['<Alt-Key-2>'],
}
+
if keySetName:
if not (self.userCfg['keys'].has_section(keySetName) or
self.defaultCfg['keys'].has_section(keySetName)):
@@ -670,7 +690,8 @@ class IdleConf:
binding = self.GetKeyBinding(keySetName, event)
if binding:
keyBindings[event] = binding
- else: #we are going to return a default, print warning
+ # Otherwise return default in keyBindings.
+ elif event not in self.former_extension_events:
warning = (
'\n Warning: config.py - IdleConf.GetCoreKeys -\n'
' problem retrieving key binding for event %r\n'