Load segments from specific segment modules

This commit is contained in:
Kim Silkebækken 2012-12-13 12:49:15 +01:00
parent 04993264e4
commit c2dfabdb8d
2 changed files with 2 additions and 6 deletions

View File

@ -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)

View File

@ -14,10 +14,11 @@ class Theme(object):
contents = None
contents_func = None
segment_type = segment.get('type', 'function')
segment_module = segment.get('module', 'core')
if segment_type == 'function':
# 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']
contents_func = getattr(importlib.import_module(function_module), function_name)
elif segment_type == 'string':