summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/configHandler.py
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2001-10-23 10:42:12 (GMT)
committerSteven M. Gava <elguavas@python.net>2001-10-23 10:42:12 (GMT)
commit429a86af5b07ae365c170c35fb26c4b637146925 (patch)
tree8e3b691ca7797f84e56fd0de5fc682c9b202e8ff /Lib/idlelib/configHandler.py
parentc77db34575f8ea73a5f53baf5a68fb0d39850573 (diff)
downloadcpython-429a86af5b07ae365c170c35fb26c4b637146925.zip
cpython-429a86af5b07ae365c170c35fb26c4b637146925.tar.gz
cpython-429a86af5b07ae365c170c35fb26c4b637146925.tar.bz2
font/tabs config dialog page now reads its data from the config file
Diffstat (limited to 'Lib/idlelib/configHandler.py')
-rw-r--r--Lib/idlelib/configHandler.py49
1 files changed, 34 insertions, 15 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 86bc004..26bb459 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -21,29 +21,31 @@ class IdleConfParser(ConfigParser):
self.file=cfgFile
ConfigParser.__init__(self,defaults=cfgDefaults)
- def GetInt(self, section, option):
- """
- Get an option value as an integer
- """
- return self.Get(section, option, type='int')
-
- def GetBool(self, section, option):
- """
- Get an option value as a boolean
- """
- return self.Get(section, option, type='bool')
+# 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, 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.
If type is specified, return as type.
"""
- if type=='bool': getVal=self.getbool
+ if type=='bool': getVal=self.getboolean
elif type=='int': getVal=self.getint
else: getVal=self.get
if self.has_option(section,option):
- return getVal(section, option, raw, vars)
+ #return getVal(section, option, raw, vars)
+ return getVal(section, option)
else:
return default
@@ -136,6 +138,23 @@ class IdleConf:
self.defaultCfg[cfgType]=IdleConfParser(defCfgFiles[cfgType])
self.userCfg[cfgType]=IdleUserConfParser(usrCfgFiles[cfgType])
+ def GetDefault(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,
+ return as type. Firstly the user configuration is checked, with a
+ fallback to the default configuration, and a final 'catch all'
+ fallback to a useable passed-in default if the option isn't present in
+ either the user or the default configuration.
+ configType must be one of ('main','extensions','highlight','keys')
+ """
+ if self.userCfg[configType].has_option(section,option):
+ return self.userCfg[configType].Get(section, option, type=type)
+ elif self.defaultCfg[configType].has_option(section,option):
+ return self.defaultCfg[configType].Get(section, option, type=type)
+ else:
+ return default
+
def LoadCfgFiles(self):
"""
load all configuration files.