More fixes, kinda runs now
This commit is contained in:
parent
45ffa9dece
commit
7312a284a3
@ -181,10 +181,10 @@ class Config:
|
|||||||
return fallback
|
return fallback
|
||||||
else:
|
else:
|
||||||
if raw:
|
if raw:
|
||||||
return val
|
return val.value
|
||||||
newval = self._interpolation.before_get(
|
newval = self._interpolation.before_get(
|
||||||
self, section, option, val.value,
|
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))
|
logging.debug("interpolated val: {}".format(newval))
|
||||||
newval = val.typ.transform(newval)
|
newval = val.typ.transform(newval)
|
||||||
return newval
|
return newval
|
||||||
@ -207,6 +207,10 @@ class Config:
|
|||||||
# FIXME to be implemented
|
# FIXME to be implemented
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def optionxform(self, val):
|
||||||
|
"""Implemented to be compatible with ConfigParser interpolation."""
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
class ReadConfigParser(ConfigParser):
|
class ReadConfigParser(ConfigParser):
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ def get_stylesheet(template):
|
|||||||
The formatted template as string.
|
The formatted template as string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
cdict = config.config['colors'].values
|
cdict = config.config['colors']
|
||||||
fdict = config.config['fonts'].values
|
fdict = config.config['fonts']
|
||||||
return template.strip().format(color=ColorDict(cdict),
|
return template.strip().format(color=ColorDict(cdict),
|
||||||
font=FontDict(fdict))
|
font=FontDict(fdict))
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class ColorDict(dict):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
val = super().__getitem__(key).value
|
val = super().__getitem__(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return ''
|
return ''
|
||||||
if 'fg' in key.split('.'):
|
if 'fg' in key.split('.'):
|
||||||
@ -82,7 +82,7 @@ class ColorDict(dict):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return super().__getitem__(key).value
|
return super().__getitem__(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class FontDict(dict):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
val = super().__getitem__(key).value
|
val = super().__getitem__(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return ''
|
return ''
|
||||||
else:
|
else:
|
||||||
@ -122,6 +122,6 @@ class FontDict(dict):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return super().__getitem__(key).value
|
return super().__getitem__(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user