Handle segment exclude/include modes
This commit is contained in:
parent
19248503ef
commit
42d8353db6
|
@ -19,7 +19,7 @@ class Renderer(object):
|
||||||
provided they will fill the remaining space until the desired width is
|
provided they will fill the remaining space until the desired width is
|
||||||
reached.
|
reached.
|
||||||
'''
|
'''
|
||||||
self.segments = self.theme.get_segments()
|
self.segments = self.theme.get_segments(mode)
|
||||||
rendered_highlighted = self._render_segments(mode)
|
rendered_highlighted = self._render_segments(mode)
|
||||||
|
|
||||||
if not width:
|
if not width:
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Theme(object):
|
||||||
'''
|
'''
|
||||||
return self.dividers[side][type]
|
return self.dividers[side][type]
|
||||||
|
|
||||||
def get_segments(self):
|
def get_segments(self, mode):
|
||||||
'''Return all segments.
|
'''Return all segments.
|
||||||
|
|
||||||
Function segments are called, and all segments get their before/after
|
Function segments are called, and all segments get their before/after
|
||||||
|
@ -59,6 +59,9 @@ class Theme(object):
|
||||||
'''
|
'''
|
||||||
return_segments = []
|
return_segments = []
|
||||||
for segment in self.segments:
|
for segment in self.segments:
|
||||||
|
if mode in segment['exclude_modes'] or (segment['include_modes'] and segment not in segment['include_modes']):
|
||||||
|
continue
|
||||||
|
|
||||||
if segment['type'] == 'function':
|
if segment['type'] == 'function':
|
||||||
contents_func_ret = segment['contents_func'](**segment['args'])
|
contents_func_ret = segment['contents_func'](**segment['args'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue