fix missing tag icons in stack.RawTable

This commit is contained in:
Johann Dreo 2023-08-21 18:55:32 +02:00
commit c1ad98b63d

View file

@ -227,8 +227,9 @@ class stack:
return sorted(tasks, key = p_value, reverse = self.reverse)
class RawTable(Stacker):
def __init__(self, tasker, sorter = None):
def __init__(self, tasker, sorter = None, tag_icons = ["+",""]):
super().__init__(tasker, sorter = sorter)
self.tag_icons = tag_icons
def __call__(self, tasks):
keys = self.tasker.show_only
@ -260,10 +261,21 @@ class stack:
row.append( rich.text.Text(short, style='short_description', end='') + \
rich.text.Text(':', style='default', end='') + \
rich.text.Text(desc, style='long_description', end='') )
else:
row.append( rich.text.Text(val, style=k) )
elif type(val) == list:
# FIXME use Columns if does not expand.
if k == 'tags':
tags = rich.text.Text("")
for t in val:
# FIXME use Columns if/when it does not expand.
tags += \
rich.text.Text(self.tag_icons[0], style="tags_ends") + \
rich.text.Text(t, style=k) + \
rich.text.Text(self.tag_icons[1], style="tags_ends") + \
" "
row.append( tags )
else:
row.append( rich.text.Text(" ".join(val), style=k) )
else:
row.append( rich.text.Text(str(val), style=k) )
@ -439,7 +451,7 @@ def get_swatches(name = None):
'status': '',
'uuid': '',
'tags': '',
'tags': '',
'tags_ends': '',
'urgency': '',
'row_odd': '',
'row_even' : '',
@ -459,7 +471,7 @@ def get_swatches(name = None):
'status': 'bold italic white',
'uuid': '',
'tags': 'color(33)',
'tags': 'color(33)',
'tags_ends': 'color(26)',
'urgency': 'color(219)',
'row_odd': 'on #262121',
'row_even' : 'on #2d2929',
@ -733,6 +745,10 @@ if __name__ == "__main__":
sorter = stack.sort.Field(config["layout.stack.sort"], reverse = as_bool(config["layout.stack.sort.reverse"]))
else:
sorter = None
if config["layout.stack"] == "RawTable":
stacker = layouts['stack']["RawTable"](tasker, sorter = sorter, tag_icons = get_icons(config["design.icons"])['tag'])
else:
stacker = layouts['stack'][config["layout.stack"]](tasker, sorter = sorter)
if config["layout.sections.group"]: