More fixes, kinda runs now

This commit is contained in:
Florian Bruhin 2014-04-07 16:51:14 +02:00
parent 45ffa9dece
commit 7312a284a3
2 changed files with 12 additions and 8 deletions

View File

@ -181,10 +181,10 @@ class Config:
return fallback
else:
if raw:
return val
return val.value
newval = self._interpolation.before_get(
self, section, option, val.value,
self.config[section].values)
{key: val.value for key, val in self.config[section].values.items()})
logging.debug("interpolated val: {}".format(newval))
newval = val.typ.transform(newval)
return newval
@ -207,6 +207,10 @@ class Config:
# FIXME to be implemented
pass
def optionxform(self, val):
"""Implemented to be compatible with ConfigParser interpolation."""
return val
class ReadConfigParser(ConfigParser):

View File

@ -30,8 +30,8 @@ def get_stylesheet(template):
The formatted template as string.
"""
cdict = config.config['colors'].values
fdict = config.config['fonts'].values
cdict = config.config['colors']
fdict = config.config['fonts']
return template.strip().format(color=ColorDict(cdict),
font=FontDict(fdict))
@ -61,7 +61,7 @@ class ColorDict(dict):
"""
try:
val = super().__getitem__(key).value
val = super().__getitem__(key)
except KeyError:
return ''
if 'fg' in key.split('.'):
@ -82,7 +82,7 @@ class ColorDict(dict):
"""
try:
return super().__getitem__(key).value
return super().__getitem__(key)
except KeyError:
return None
@ -105,7 +105,7 @@ class FontDict(dict):
"""
try:
val = super().__getitem__(key).value
val = super().__getitem__(key)
except KeyError:
return ''
else:
@ -122,6 +122,6 @@ class FontDict(dict):
"""
try:
return super().__getitem__(key).value
return super().__getitem__(key)
except KeyError:
return None