Fix “default_module” theme key support
Reverts commit 78e54e0c84
and moves
default_module into Segments.__init__.
Refs #3.
This commit is contained in:
parent
033afade95
commit
1a7d67f5a7
|
@ -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():
|
||||
|
|
|
@ -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, [])))
|
||||
|
||||
|
|
Loading…
Reference in New Issue