From 72c3bf076f785aaf54d63a7e8cae29bc8282920e Mon Sep 17 00:00:00 2001 From: "Steven M. Gava" Date: Sat, 19 Jan 2002 10:41:51 +0000 Subject: changeover to new keybinding configuration implementation --- Lib/idlelib/AutoExpand.py | 8 ------- Lib/idlelib/AutoIndent.py | 34 --------------------------- Lib/idlelib/Bindings.py | 2 +- Lib/idlelib/CallTips.py | 13 ----------- Lib/idlelib/EditorWindow.py | 13 ++--------- Lib/idlelib/ExecBinding.py | 5 ---- Lib/idlelib/FormatParagraph.py | 8 ------- Lib/idlelib/ParenMatch.py | 12 ---------- Lib/idlelib/ScriptBinding.py | 6 ----- Lib/idlelib/ZoomHeight.py | 9 +------ Lib/idlelib/config-extensions.def | 49 ++++++++++++++++++++++++++++++++++++--- 11 files changed, 50 insertions(+), 109 deletions(-) diff --git a/Lib/idlelib/AutoExpand.py b/Lib/idlelib/AutoExpand.py index 09f34b3..c50e52a 100644 --- a/Lib/idlelib/AutoExpand.py +++ b/Lib/idlelib/AutoExpand.py @@ -7,14 +7,6 @@ import re class AutoExpand: - keydefs = { - '<>': [''], - } - - unix_keydefs = { - '<>': ['', ''], - } - menudefs = [ ('edit', [ ('E_xpand word', '<>'), diff --git a/Lib/idlelib/AutoIndent.py b/Lib/idlelib/AutoIndent.py index 6d38481..eff398b 100644 --- a/Lib/idlelib/AutoIndent.py +++ b/Lib/idlelib/AutoIndent.py @@ -41,7 +41,6 @@ class AutoIndent: menudefs = [ ('format', [ # /s/edit/format dscherer@cmu.edu - None, ('_Indent region', '<>'), ('_Dedent region', '<>'), ('Comment _out region', '<>'), @@ -53,39 +52,6 @@ class AutoIndent: ]), ] - keydefs = { - '<>': [''], - '<>': ['', ''], - '<>': [''] - } - - windows_keydefs = { - '<>': [''], - '<>': ['', # dscherer@cmu.edu - ''], - '<>': [''], - '<>': [''], - '<>': [''], - '<>': [''], - '<>': [''], - '<>': [''], - } - - unix_keydefs = { - '<>': ['', - '', - ''], - '<>': ['', - '', - ''], - '<>': ['', ''], - '<>': ['', ''], - '<>': ['', ''], - '<>': ['', ''], - '<>': [''], - '<>': [''], - } - # usetabs true -> literal tab characters are used by indent and # dedent cmds, possibly mixed with spaces if # indentwidth is not a multiple of tabwidth diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py index 862ceb6..2269a90 100644 --- a/Lib/idlelib/Bindings.py +++ b/Lib/idlelib/Bindings.py @@ -73,6 +73,6 @@ menudefs = [ ]), ] -default_keydefs = idleConf.GetKeys(keySetName=idleConf.CurrentKeys()) +default_keydefs = idleConf.GetCurrentKeySet() del sys diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index 7c5f41c..b1f100f 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -10,19 +10,6 @@ class CallTips: menudefs = [ ] - keydefs = { - '<>': [''], - '<>': [''], - '<>': [''], - '<>': ['', ''], - } - - windows_keydefs = { - } - - unix_keydefs = { - } - def __init__(self, editwin): self.editwin = editwin self.text = editwin.text diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 237a462..bba1702 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -590,17 +590,7 @@ class EditorWindow: cls = getattr(mod, name) ins = cls(self) self.extensions[name] = ins - kdnames = ["keydefs"] - if sys.platform == 'win32': - kdnames.append("windows_keydefs") - elif sys.platform == 'mac': - kdnames.append("mac_keydefs") - else: - kdnames.append("unix_keydefs") - keydefs = {} - for kdname in kdnames: - if hasattr(ins, kdname): - keydefs.update(getattr(ins, kdname)) + keydefs=idleConf.GetExtensionBindings(name) if keydefs: self.apply_bindings(keydefs) for vevent in keydefs.keys(): @@ -612,6 +602,7 @@ class EditorWindow: methodname = methodname + "_event" if hasattr(ins, methodname): self.text.bind(vevent, getattr(ins, methodname)) + if hasattr(ins, "menudefs"): self.fill_menus(ins.menudefs, keydefs) return ins diff --git a/Lib/idlelib/ExecBinding.py b/Lib/idlelib/ExecBinding.py index 67b0822..e148769 100644 --- a/Lib/idlelib/ExecBinding.py +++ b/Lib/idlelib/ExecBinding.py @@ -45,11 +45,6 @@ def loader_connect(client, addr): protocol.publish('ExecBinding', loader_connect) class ExecBinding: - keydefs = { - '<>': [''], - '<>': [''], #'' - } - menudefs = [ ('run', [None, ('Run program', '<>'), diff --git a/Lib/idlelib/FormatParagraph.py b/Lib/idlelib/FormatParagraph.py index 498e2ef..cf5e365 100644 --- a/Lib/idlelib/FormatParagraph.py +++ b/Lib/idlelib/FormatParagraph.py @@ -25,14 +25,6 @@ class FormatParagraph: ]) ] - keydefs = { - '<>': [''], - } - - unix_keydefs = { - '<>': [''], - } - def __init__(self, editwin): self.editwin = editwin diff --git a/Lib/idlelib/ParenMatch.py b/Lib/idlelib/ParenMatch.py index 17d76c2..7851422 100644 --- a/Lib/idlelib/ParenMatch.py +++ b/Lib/idlelib/ParenMatch.py @@ -43,19 +43,7 @@ class ParenMatch: to the right of a right paren. I don't know how to do that in Tk, so I haven't bothered. """ - menudefs = [] - - keydefs = { - '<>' : ('', - '', - ''), - '<>' : ('',), - } - - windows_keydefs = {} - unix_keydefs = {} - iconf = idleconf.getsection('ParenMatch') STYLE = iconf.getdef('style', 'default') FLASH_DELAY = iconf.getint('flash-delay') diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py index b54dfc4..2b3bf99 100644 --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -35,12 +35,6 @@ by Untabify Region (both in the Edit menu).""" class ScriptBinding: - keydefs = { - '<>': ['', ''], - '<>': [''], - '<>': [''], - } - menudefs = [ ('edit', [None, ('Check module', '<>'), diff --git a/Lib/idlelib/ZoomHeight.py b/Lib/idlelib/ZoomHeight.py index ecc306a..f2b99e9 100644 --- a/Lib/idlelib/ZoomHeight.py +++ b/Lib/idlelib/ZoomHeight.py @@ -10,14 +10,7 @@ class ZoomHeight: ('_Zoom Height', '<>'), ]) ] - - windows_keydefs = { - '<>': [''], - } - unix_keydefs = { - '<>': [''], - } - + def __init__(self, editwin): self.editwin = editwin diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index b4e9b02..c0439e6 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -1,26 +1,66 @@ # IDLE reads several config files to determine user preferences. This # file is the default config file for idle extensions settings. +# +# Each extension must have at least one section, named after the extension +# module. This section must contain an 'enable' item (=1 to enable the +# extension, =0 to disable it) and also contains any other general configuration +# items for the extension. Each extension may also define up to two optional +# sections named ExtensionName_bindings and ExtensionName_cfgBindings. If +# present, ExtensionName_bindings defines virtual event bindings for the +# extension that are not sensibly re-configurable. If present, +# ExtensionName_cfgBindings defines virtual event bindings for the extension +# that may be sensibly re-configured. [FormatParagraph] enable=1 +[FormatParagraph_cfgBindings] +format-paragraph= [AutoIndent] enable=1 +[AutoIndent_cfgBindings] +smart-backspace= +newline-and-indent= +smart-indent= +indent-region= +dedent-region= +comment-region= +uncomment-region= +tabify-region= +untabify-region= +toggle-tabs= +change-indentwidth= [AutoExpand] enable=1 +[AutoExpand_cfgBindings] +expand-word= [ZoomHeight] enable=1 - -#[ScriptBinding] # disabled in favor of ExecBinding -#enable=0 +[ZoomHeight_cfgBindings] +zoom-height= [ExecBinding] enable=1 +[ExecBinding_cfgBindings] +run-complete-script= +stop-execution= + +#[ScriptBinding] #currently ExecBinding has replaced ScriptBinding +#enable=0 +#[ScriptBinding_cfgBindings] +#run-script= +#check-module= +#import-module= [CallTips] enable=1 +[CallTips_bindings] +paren-open= +paren-close= +check-calltip-cancel= +calltip-cancel= [ParenMatch] enable=0 @@ -29,3 +69,6 @@ flash-delay= 500 bell= 1 hilite-foreground= black hilite-background= #43cd80 +[ParenMatch_bindings] +flash-open-paren= +check-restore= -- cgit v0.12