summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/autocomplete.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/autocomplete.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/autocomplete.py')
-rw-r--r--Lib/idlelib/autocomplete.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py
index cd212cc..edf445f 100644
--- a/Lib/idlelib/autocomplete.py
+++ b/Lib/idlelib/autocomplete.py
@@ -1,7 +1,7 @@
-"""autocomplete.py - An IDLE extension for automatically completing names.
+"""Complete either attribute names or file names.
-This extension can complete either attribute names or file names. It can pop
-a window with all available names, for the user to select from.
+Either on demand or after a user-selected delay after a key character,
+pop up a list of candidates.
"""
import os
import string
@@ -27,18 +27,9 @@ if os.altsep: # e.g. '/' on Windows...
class AutoComplete:
- menudefs = [
- ('edit', [
- ("Show Completions", "<<force-open-completions>>"),
- ])
- ]
-
- popupwait = idleConf.GetOption("extensions", "AutoComplete",
- "popupwait", type="int", default=0)
-
def __init__(self, editwin=None):
self.editwin = editwin
- if editwin is not None: # not in subprocess or test
+ if editwin is not None: # not in subprocess or test
self.text = editwin.text
self.autocompletewindow = None
# id of delayed call, and the index of the text insert when
@@ -47,6 +38,11 @@ class AutoComplete:
self._delayed_completion_id = None
self._delayed_completion_index = None
+ @classmethod
+ def reload(cls):
+ cls.popupwait = idleConf.GetOption(
+ "extensions", "AutoComplete", "popupwait", type="int", default=0)
+
def _make_autocomplete_window(self):
return autocomplete_w.AutoCompleteWindow(self.text)
@@ -228,6 +224,9 @@ class AutoComplete:
return eval(name, namespace)
+AutoComplete.reload()
+
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_autocomplete', verbosity=2)