diff options
author | wohlganger <charles.wohlganger@gmail.com> | 2017-09-10 16:19:47 -0500 |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2017-09-10 17:19:47 -0400 |
commit | 58fc71c447049d0efe4e11db1b55edc307f1bede (patch) | |
tree | 237891f31c741848809fa8dab7b6652849f37fa0 /Lib/idlelib/parenmatch.py | |
parent | d39dbf4cf18488beb190ab358b7ab38792cd5043 (diff) | |
download | cpython-git-58fc71c447049d0efe4e11db1b55edc307f1bede.tar.gz |
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/parenmatch.py')
-rw-r--r-- | Lib/idlelib/parenmatch.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Lib/idlelib/parenmatch.py b/Lib/idlelib/parenmatch.py index 7f25880ae5..12212150c6 100644 --- a/Lib/idlelib/parenmatch.py +++ b/Lib/idlelib/parenmatch.py @@ -1,4 +1,4 @@ -"""ParenMatch -- An IDLE extension for parenthesis matching. +"""ParenMatch -- for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to @@ -30,18 +30,6 @@ class ParenMatch: - Highlight when cursor is moved to the right of a closer. This might be too expensive to check. """ - menudefs = [ - ('edit', [ - ("Show surrounding parens", "<<flash-paren>>"), - ]) - ] - STYLE = idleConf.GetOption( - 'extensions','ParenMatch','style', default='expression') - FLASH_DELAY = idleConf.GetOption( - 'extensions','ParenMatch','flash-delay', type='int',default=500) - BELL = idleConf.GetOption( - 'extensions','ParenMatch','bell', type='bool',default=1) - HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(),'hilite') RESTORE_VIRTUAL_EVENT_NAME = "<<parenmatch-check-restore>>" # We want the restore event be called before the usual return and @@ -62,6 +50,17 @@ class ParenMatch: self.is_restore_active = 0 self.set_style(self.STYLE) + @classmethod + def reload(cls): + cls.STYLE = idleConf.GetOption( + 'extensions','ParenMatch','style', default='opener') + cls.FLASH_DELAY = idleConf.GetOption( + 'extensions','ParenMatch','flash-delay', type='int',default=500) + cls.BELL = idleConf.GetOption( + 'extensions','ParenMatch','bell', type='bool', default=1) + cls.HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(), + 'hilite') + def activate_restore(self): "Activate mechanism to restore text from highlighting." if not self.is_restore_active: @@ -181,6 +180,9 @@ class ParenMatch: lambda self=self, c=self.counter: self.handle_restore_timer(c)) +ParenMatch.reload() + + if __name__ == '__main__': import unittest unittest.main('idlelib.idle_test.test_parenmatch', verbosity=2) |