diff --git a/powerline/core.py b/powerline/core.py index d3c407d6..6159f473 100644 --- a/powerline/core.py +++ b/powerline/core.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from lib.colors import cterm_to_hex +from segment import mksegment class Powerline(object): @@ -140,23 +140,3 @@ class Powerline(object): that the segments have been rendered using the render() method first. ''' return len(''.join([segment['rendered_raw'] for segment in self.segments])) - - -def mksegment(contents=None, cterm_fg=False, cterm_bg=False, attr=False, hex_fg=False, hex_bg=False, side='l', draw_divider=True, priority=-1, filler=False): - '''Convenience wrapper for segment generation. - ''' - try: - contents = unicode(contents or u'') - except UnicodeDecodeError: - contents = contents.decode('utf-8') or u'' - - return { - 'contents': contents, - 'fg': (cterm_fg, hex_fg or cterm_to_hex.get(cterm_fg, 0xffffff)), - 'bg': (cterm_bg, hex_bg or cterm_to_hex.get(cterm_bg, 0x000000)), - 'attr': attr, - 'side': side, - 'draw_divider': False if filler else draw_divider, - 'priority': priority, - 'filler': filler, - } diff --git a/powerline/segment.py b/powerline/segment.py index 40a96afc..e8955a8b 100644 --- a/powerline/segment.py +++ b/powerline/segment.py @@ -1 +1,23 @@ # -*- coding: utf-8 -*- + +from colorscheme import cterm_to_hex + + +def mksegment(contents=None, cterm_fg=False, cterm_bg=False, attr=False, hex_fg=False, hex_bg=False, side='l', draw_divider=True, priority=-1, filler=False): + '''Convenience wrapper for segment generation. + ''' + try: + contents = unicode(contents or u'') + except UnicodeDecodeError: + contents = contents.decode('utf-8') or u'' + + return { + 'contents': contents, + 'fg': (cterm_fg, hex_fg or cterm_to_hex.get(cterm_fg, 0xffffff)), + 'bg': (cterm_bg, hex_bg or cterm_to_hex.get(cterm_bg, 0x000000)), + 'attr': attr, + 'side': side, + 'draw_divider': False if filler else draw_divider, + 'priority': priority, + 'filler': filler, + }