summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2001-10-26 06:50:54 (GMT)
committerSteven M. Gava <elguavas@python.net>2001-10-26 06:50:54 (GMT)
commit2a63a079126bc5345ccc2029a756fd1ac33d096b (patch)
tree5967134f3ef93554b636ce62fab155eb0872a3c0 /Lib/idlelib
parentf126bcb65373151ba6b6d026a5436bf27ecb6e0f (diff)
downloadcpython-2a63a079126bc5345ccc2029a756fd1ac33d096b.zip
cpython-2a63a079126bc5345ccc2029a756fd1ac33d096b.tar.gz
cpython-2a63a079126bc5345ccc2029a756fd1ac33d096b.tar.bz2
further work supporting reading config dialog values form config files.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/configHandler.py60
1 files changed, 40 insertions, 20 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 26bb459..e071352 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -4,7 +4,9 @@
## elguavas
##
##---------------------------------------------------------------------------##
-"""Provides access to configuration information"""
+"""
+Provides access to configuration information
+"""
import os
import sys
@@ -21,20 +23,6 @@ class IdleConfParser(ConfigParser):
self.file=cfgFile
ConfigParser.__init__(self,defaults=cfgDefaults)
-# def GetInt(self, section, option, *kw):
-# """
-# Get an option value as an integer
-# """
-# return self.Get(section, option, type='int', *kw)
-#
-# def GetBool(self, section, option, **kw):
-# """
-# Get an option value as a boolean
-# """
-# return self.Get(section, option, type='bool', *kw)
-
-# def Get(self, section, option, raw=0, vars=None, default=None,
-# type=None):
def Get(self, section, option, default=None, type=None):
"""
Get an option value for given section/option or return default.
@@ -49,10 +37,6 @@ class IdleConfParser(ConfigParser):
else:
return default
- def GetSectionList(self):
- # only provided for consistency
- return self.sections()
-
def GetOptionList(self,section):
"""
Get an option list for given section
@@ -138,7 +122,7 @@ class IdleConf:
self.defaultCfg[cfgType]=IdleConfParser(defCfgFiles[cfgType])
self.userCfg[cfgType]=IdleUserConfParser(usrCfgFiles[cfgType])
- def GetDefault(self, configType, section, option, default=None, type=None):
+ def GetOption(self, configType, section, option, default=None, type=None):
"""
Get an option value for given config type and given general
configuration section/option or return a default. If type is specified,
@@ -155,6 +139,42 @@ class IdleConf:
else:
return default
+ def GetSectionList(self, configSet, configType):
+ """
+ Get a list of sections from either the user or default config for
+ the given config type.
+ configSet must be either 'user' or 'default'
+ configType must be one of ('extensions','highlight','keys')
+ """
+ if not (configType in ('extensions','highlight','keys')):
+ raise 'Invalid configType specified'
+ if configSet == 'user':
+ cfgParser=self.userCfg[configType]
+ elif configSet == 'default':
+ cfgParser=self.defaultCfg[configType]
+ else:
+ raise 'Invalid configSet specified'
+
+ return cfgParser.sections()
+
+
+ def GetTheme(self, name=None):
+ """
+ Gets the requested theme or returns a final fallback theme in case
+ one can't be obtained from either the user or default config files.
+ """
+ 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 LoadCfgFiles(self):
"""
load all configuration files.