diff --git a/powerline/core.py b/powerline/core.py index 45283c94..82d6284c 100644 --- a/powerline/core.py +++ b/powerline/core.py @@ -33,7 +33,7 @@ class Powerline(object): # Load and initialize extension theme theme_config = self._load_json_config(os.path.join('themes', ext, self.config_ext['theme'])) - self.theme = Theme(ext, theme_config) + self.theme = Theme(ext, theme_config, self.config) # Load and initialize extension renderer renderer_module_name = 'powerline.ext.{0}.renderer'.format(ext) diff --git a/powerline/theme.py b/powerline/theme.py index 05dfb4f9..a68f80c3 100644 --- a/powerline/theme.py +++ b/powerline/theme.py @@ -4,11 +4,12 @@ import importlib class Theme(object): - def __init__(self, ext, theme): + def __init__(self, ext, theme_config, common_config): + self.dividers = theme_config.get('dividers', common_config['dividers']) self.segments = [] for side in ['left', 'right']: - for segment in theme['segments'].get(side, []): + for segment in theme_config['segments'].get(side, []): contents = None segment_type = segment.get('type', 'function') @@ -40,5 +41,8 @@ class Theme(object): 'include_modes': segment.get('include_modes', []), }) + def get_divider(self, side='left', type='soft'): + return self.dividers[side][type] + def get_segments(self): return self.segments