Load segments from specific segment modules
This commit is contained in:
parent
04993264e4
commit
c2dfabdb8d
|
@ -1,5 +0,0 @@
|
||||||
# flake8: noqa
|
|
||||||
|
|
||||||
from core import (mode, modified_indicator, paste_indicator,
|
|
||||||
readonly_indicator, branch, file_directory, file_name, file_format,
|
|
||||||
file_encoding, file_type, line_percent, line_current, col_current)
|
|
|
@ -14,10 +14,11 @@ class Theme(object):
|
||||||
contents = None
|
contents = None
|
||||||
contents_func = None
|
contents_func = None
|
||||||
segment_type = segment.get('type', 'function')
|
segment_type = segment.get('type', 'function')
|
||||||
|
segment_module = segment.get('module', 'core')
|
||||||
|
|
||||||
if segment_type == 'function':
|
if segment_type == 'function':
|
||||||
# Import segment function and assign it to the contents
|
# Import segment function and assign it to the contents
|
||||||
function_module = 'powerline.ext.{0}.segments'.format(ext)
|
function_module = 'powerline.ext.{0}.segments.{1}'.format(ext, segment_module)
|
||||||
function_name = segment['name']
|
function_name = segment['name']
|
||||||
contents_func = getattr(importlib.import_module(function_module), function_name)
|
contents_func = getattr(importlib.import_module(function_module), function_name)
|
||||||
elif segment_type == 'string':
|
elif segment_type == 'string':
|
||||||
|
|
Loading…
Reference in New Issue