From 17d015409765d29e199d4828cb136acd3196efe6 Mon Sep 17 00:00:00 2001 From: "Steven M. Gava" Date: Mon, 3 Dec 2001 00:37:28 +0000 Subject: further work on new configuration system, specifically, on keybinding configuration --- Lib/idlelib/Bindings.py | 13 +++-- Lib/idlelib/config-keys.def | 114 +++++++++++++++++++++++-------------------- Lib/idlelib/configHandler.py | 49 ++++++++++++++++--- 3 files changed, 110 insertions(+), 66 deletions(-) diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py index 7baa913..1a8374b 100644 --- a/Lib/idlelib/Bindings.py +++ b/Lib/idlelib/Bindings.py @@ -14,7 +14,8 @@ import sys import string -from keydefs import * +#from keydefs import * +from configHandler import idleConf menudefs = [ # underscore prefixes character to underscore @@ -65,9 +66,11 @@ menudefs = [ ]), ] -if sys.platform == 'win32': - default_keydefs = windows_keydefs -else: - default_keydefs = unix_keydefs +#if sys.platform == 'win32': +# default_keydefs = windows_keydefs +#else: +# default_keydefs = unix_keydefs + +default_keydefs = idleConf.GetKeys(keySetName=None) del sys diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def index cae0301..feec31c 100644 --- a/Lib/idlelib/config-keys.def +++ b/Lib/idlelib/config-keys.def @@ -1,58 +1,64 @@ # IDLE reads several config files to determine user preferences. This # file is the default config file for idle key binding settings. +# Where multiple keys are specified for an action: if they are separated +# by a space (eg. action= ) then the keys are altenatives, if +# there is no space (eg. action=key2>) then the keys comprise a +# single 'emacs style' multi-keystoke binding. -[IDLE Classic - windows] -Copy= ' ' -Cut= ' ' -Paste= ' ' -beginning-of-line= ' ' -center-insert= '' -close-all-windows= '' -close-window= '' -dump-undo-state= '' -end-of-file= '' -python-docs= '' -history-next= '' -history-previous= '' -interrupt-execution= '' -open-class-browser= '' -open-module= '' -open-new-window= '' -open-window-from-file= '' -plain-newline-and-indent= '' -redo= '' -remove-selection= '' -save-copy-of-window-as-file= '' -save-window-as-file= '' -save-window= '' -select-all= '' -toggle-auto-coloring= '' -undo= '' +[IDLE CUA-ish] +Copy= +Cut= +Paste= +beginning-of-line= +center-insert= +close-all-windows= +close-window= +dump-undo-state= +end-of-file= +python-docs= +python-context-help= +history-next= +history-previous= +interrupt-execution= +open-class-browser= +open-module= +open-new-window= +open-window-from-file= +plain-newline-and-indent= +redo= +remove-selection= +save-copy-of-window-as-file= +save-window-as-file= +save-window= +select-all= +toggle-auto-coloring= +undo= -[IDLE Classic - posix] -Copy= ' ' -Cut= '' -Paste= '' -beginning-of-line= ' ' -center-insert= '' -close-all-windows= '' -close-window= ' ' -do-nothing= '' -dump-undo-state= '' -end-of-file= '' -help= '' -history-next= ' ' -history-previous= ' ' -interrupt-execution= '' -open-class-browser= '' -open-module= '' -open-new-window= '' -open-window-from-file= '' -plain-newline-and-indent= '' -redo= ' ' -save-copy-of-window-as-file= '' -save-window-as-file= '' -save-window= '' -select-all= ' ' -toggle-auto-coloring= '' -undo= '' +[IDLE Emacs-ish] +Copy= +Cut= +Paste= +beginning-of-line= +center-insert= +close-all-windows= +close-window= +do-nothing= +dump-undo-state= +end-of-file= +history-next= +history-previous= +interrupt-execution= +open-class-browser= +open-module= +open-new-window= +open-window-from-file= +plain-newline-and-indent= +python-docs= +python-context-help= +redo= +save-copy-of-window-as-file= +save-window-as-file= +save-window= +select-all= +toggle-auto-coloring= +undo= diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 4539627..f1fbd8d 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -174,13 +174,48 @@ class IdleConf: """ pass - def GetKeys(self, name=None): - """ - Gets the requested keybindings or returns a final fallback keybinding - set in case one can't be obtained from either the user or default - config files. - """ - pass + def GetKeys(self, keySetName=None): + """ + returns the requested keybindings, with fallbacks if required. + """ + #default keybindings. + #keybindings loaded from the config file(s) are loaded _over_ these + #defaults, so if there is a problem getting any binding there will + #be an 'ultimate last resort fallback' to the CUA-ish bindings + #defined here. + keyBindings={ + '<>': ['', ''], + '<>': ['', ''], + '<>': ['', ''], + '<>': ['', ''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': ['']} + if keySetName: + pass + + return keyBindings + def LoadCfgFiles(self): """ -- cgit v0.12