add some theme on raw
This commit is contained in:
parent
058441c680
commit
fc9024ab82
4 changed files with 91 additions and 15 deletions
|
|
@ -10,3 +10,9 @@
|
|||
{"description":"semantic allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171645Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||
{"description":"semantic tags : allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171703Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||
{"description":"styling: apply configurable styles to each field and state with semantics","entry":"20230811T171937Z","modified":"20230811T171937Z","status":"pending","uuid":"17819637-4f4a-4e46-8622-12d8243c54da","tags":["feat"]}
|
||||
{"description":"styling: apply configurable styles to each field and state with semantics","entry":"20230811T171937Z","modified":"20230811T202525Z","start":"20230811T202525Z","status":"pending","uuid":"17819637-4f4a-4e46-8622-12d8243c54da","tags":["feat"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T182344Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["feat"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T182451Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["bug","feat"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T182523Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["feat"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T182634Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["bug"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T182638Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["feat"]}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@
|
|||
[description:"sort by urgency" entry:"1691773782" modified:"1691773782" status:"pending" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||
[description:"config file.s" entry:"1691773951" modified:"1691773951" status:"pending" tags:"feat" tags_feat:"x" uuid:"4d822c4a-d51e-4992-8a22-6e0167ac197a"]
|
||||
[description:"fix escaped add: when passing add with escapable characters, bug ensues." entry:"1691774077" modified:"1691774077" status:"pending" tags:"bug" tags_bug:"x" uuid:"79e1ba11-15ae-489f-9868-ab6adea40a91"]
|
||||
[description:"styling: apply configurable styles to each field and state with semantics" entry:"1691774377" modified:"1691774377" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
|
||||
[description:"styling: apply configurable styles to each field and state with semantics" entry:"1691774377" modified:"1691785525" start:"1691785525" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
|
||||
[description:"more themes" entry:"1691864624" modified:"1691864798" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
|
|
|
|||
|
|
@ -39,3 +39,26 @@ new [description:"semantic tags : allow tags starting with a hash to refer to a
|
|||
time 1691774377
|
||||
new [description:"styling: apply configurable styles to each field and state with semantics" entry:"1691774377" modified:"1691774377" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
|
||||
---
|
||||
time 1691785525
|
||||
old [description:"styling: apply configurable styles to each field and state with semantics" entry:"1691774377" modified:"1691774377" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
|
||||
new [description:"styling: apply configurable styles to each field and state with semantics" entry:"1691774377" modified:"1691785525" start:"1691785525" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
|
||||
---
|
||||
time 1691864624
|
||||
new [description:"more themes" entry:"1691864624" modified:"1691864624" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
time 1691864691
|
||||
old [description:"more themes" entry:"1691864624" modified:"1691864624" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
new [description:"more themes" entry:"1691864624" modified:"1691864691" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
time 1691864723
|
||||
old [description:"more themes" entry:"1691864624" modified:"1691864691" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
new [description:"more themes" entry:"1691864624" modified:"1691864723" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
time 1691864794
|
||||
old [description:"more themes" entry:"1691864624" modified:"1691864723" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
new [description:"more themes" entry:"1691864624" modified:"1691864794" status:"pending" tags:"bug" tags_bug:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
time 1691864798
|
||||
old [description:"more themes" entry:"1691864624" modified:"1691864794" status:"pending" tags:"bug" tags_bug:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
new [description:"more themes" entry:"1691864624" modified:"1691864798" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class task:
|
|||
desc = "\n".join(textwrap.wrap(desc.strip(), self.wrap_width))
|
||||
|
||||
if sid in touched:
|
||||
title = "*"+title+"*"
|
||||
title = rich.text.Text(title, style='touched')
|
||||
|
||||
segments = []
|
||||
for key in self.show_only:
|
||||
|
|
@ -74,19 +74,23 @@ class task:
|
|||
val = task[key]
|
||||
segment = f"{key}: "
|
||||
if type(val) == str:
|
||||
segments.append(segment+t)
|
||||
segments.append(rich.text.Text(segment+t, style=key))
|
||||
elif type(val) == list:
|
||||
# FIXME Columns does not fit.
|
||||
# g = Columns([f"+{t}" for t in val], expand = False)
|
||||
g = rich.console.Group(*[f"+{t}" for t in val], fit = True)
|
||||
g = rich.console.Group(*[rich.text.Text(f"+{t}", style=key) for t in val], fit = True)
|
||||
segments.append(g)
|
||||
else:
|
||||
segments.append(segment+str(val))
|
||||
segments.append(rich.text.Text(segment+str(val), style=key))
|
||||
|
||||
# FIXME Columns does not fit.
|
||||
# cols = Columns(segments)
|
||||
cols = rich.console.Group(*segments, fit = True)
|
||||
grp = rich.console.Group(desc, cols, fit = True)
|
||||
if sid in touched:
|
||||
panel = rich.panel.Panel(grp, title = title,
|
||||
title_align="left", expand = False, padding = (0,1), border_style = 'touched')
|
||||
else:
|
||||
panel = rich.panel.Panel(grp, title = title,
|
||||
title_align="left", expand = False, padding = (0,1))
|
||||
|
||||
|
|
@ -118,7 +122,7 @@ class stack:
|
|||
def __call__(self, tasks):
|
||||
keys = self.tasker.show_only
|
||||
|
||||
table = rich.table.Table(box = None, show_header = False, show_lines = True, expand = True)
|
||||
table = rich.table.Table(box = None, show_header = False, show_lines = True, expand = True, row_styles=['row_odd', 'row_even'])
|
||||
table.add_column('H')
|
||||
for k in keys:
|
||||
table.add_column(k)
|
||||
|
|
@ -126,7 +130,7 @@ class stack:
|
|||
for task in tasks:
|
||||
taskers = self.tasker(task)
|
||||
if str(task['id']) in self.tasker.touched:
|
||||
row = ['>']
|
||||
row = [rich.text.Text('▶', style = 'touched')]
|
||||
else:
|
||||
row = ['']
|
||||
|
||||
|
|
@ -134,14 +138,15 @@ class stack:
|
|||
if k in task:
|
||||
val = taskers[k]
|
||||
if type(val) == str:
|
||||
row.append( val )
|
||||
row.append( rich.text.Text(val, style=k) )
|
||||
elif type(val) == list:
|
||||
row.append( " ".join(val) )
|
||||
# FIXME use Columns if does not expand.
|
||||
row.append( rich.text.Text(" ".join(val), style=k) )
|
||||
else:
|
||||
row.append( str(val) )
|
||||
row.append( rich.text.Text(str(val), style=k) )
|
||||
else:
|
||||
row.append("")
|
||||
table.add_row(*[str(i) for i in row])
|
||||
table.add_row(*[t for t in row])
|
||||
return table
|
||||
|
||||
|
||||
|
|
@ -289,6 +294,43 @@ def parse_touched(out):
|
|||
return re.findall('[ModifyingCreated]+ task ([0-9]+)', out)
|
||||
|
||||
|
||||
def get_themes(name = None):
|
||||
themes = {
|
||||
"none": {
|
||||
'touched': '',
|
||||
'id': '',
|
||||
'description': '',
|
||||
'entry': '',
|
||||
'modified': '',
|
||||
'started': '',
|
||||
'status': '',
|
||||
'uuid': '',
|
||||
'tags': '',
|
||||
'urgency': '',
|
||||
'row_odd': '',
|
||||
'row_even' : '',
|
||||
},
|
||||
"nojhan": {
|
||||
'touched': '#4E9A06',
|
||||
'id': 'bold color(214)',
|
||||
'description': 'white',
|
||||
'entry': '',
|
||||
'modified': 'color(240)',
|
||||
'started': '',
|
||||
'status': 'bold italic white',
|
||||
'uuid': '',
|
||||
'tags': 'color(27)',
|
||||
'urgency': 'color(219)',
|
||||
'row_odd': 'on #262121',
|
||||
'row_even' : 'on #2d2929',
|
||||
},
|
||||
}
|
||||
if name:
|
||||
return themes[name]
|
||||
else:
|
||||
return themes
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
|
@ -306,6 +348,8 @@ if __name__ == "__main__":
|
|||
help="Separator used for lists that are passed as options arguments.")
|
||||
|
||||
layouts = parser.add_argument_group('layout options')
|
||||
layouts.add_argument('-t', '--theme', metavar='NAME', type=str, default='none',
|
||||
choices = get_themes().keys(), help="Color theme.")
|
||||
layouts.add_argument('--card-flat-wrap', metavar="NB", type=int, default=25,
|
||||
help="Number of character at which to wrap the description of Flat Cards.")
|
||||
|
||||
|
|
@ -331,6 +375,8 @@ if __name__ == "__main__":
|
|||
else:
|
||||
show_only = showed
|
||||
|
||||
theme = rich.theme.Theme(get_themes(asked.theme))
|
||||
|
||||
# tasker = task.Card(show_only, touched = touched, wrap_width = asked.card_flat_wrap)
|
||||
tasker = task.Raw(show_only, touched = touched)
|
||||
|
||||
|
|
@ -343,7 +389,7 @@ if __name__ == "__main__":
|
|||
# sectioner = sections.Vertical(stacker, sort_on_values, group_by_status)
|
||||
sectioner = sections.Horizontal(stacker, sort_on_values, group_by_status)
|
||||
|
||||
console = Console()
|
||||
console.rule("taskwarrior-fancy")
|
||||
console = Console(theme = theme)
|
||||
# console.rule("taskwarrior-deluxe")
|
||||
console.print(sectioner(jdata))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue