diff --git a/powerline/core.py b/powerline/core.py index 844e4c73..8df46676 100644 --- a/powerline/core.py +++ b/powerline/core.py @@ -6,7 +6,6 @@ import os import sys from colorscheme import Colorscheme -from segment import Segment from matcher import Matcher @@ -29,14 +28,12 @@ class Powerline(object): # Load and initialize extension theme theme_config = self._load_theme_config(ext, self.config_ext.get('theme', 'default')) - path = [os.path.expanduser(path) for path in self.config.get('paths', [])] - get_segment = Segment(ext, path, colorscheme, theme_config.get('default_module')).get - self.get_matcher = Matcher(ext, path).get + self.config['paths'] = [os.path.expanduser(path) for path in self.config.get('paths', [])] + self.get_matcher = Matcher(ext, self.config['paths']).get theme_kwargs = { 'ext': ext, 'colorscheme': colorscheme, 'common_config': self.config, - 'get_segment': get_segment, } local_themes = {} for key, local_theme_name in self.config_ext.get('local_themes', {}).iteritems(): diff --git a/powerline/theme.py b/powerline/theme.py index 97811b19..84ea97e2 100644 --- a/powerline/theme.py +++ b/powerline/theme.py @@ -3,9 +3,10 @@ import copy from collections import defaultdict +from segment import Segment class Theme(object): - def __init__(self, ext, colorscheme, theme_config, common_config, get_segment): + def __init__(self, ext, colorscheme, theme_config, common_config): self.colorscheme = colorscheme self.dividers = theme_config.get('dividers', common_config['dividers']) self.segments = [] @@ -13,6 +14,7 @@ class Theme(object): 'contents': None, 'highlight': defaultdict(lambda : {'fg': False, 'bg': False, 'attr': 0}) } + get_segment = Segment(ext, common_config['paths'], colorscheme, theme_config.get('default_module')).get for side in ['left', 'right']: self.segments.extend((get_segment(segment, side) for segment in theme_config['segments'].get(side, [])))