Sheet/filled theme

This commit is contained in:
Johann Dreo 2023-08-14 07:23:12 +02:00
commit a462e3505b
5 changed files with 106 additions and 10 deletions

View file

@ -21,3 +21,11 @@
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T191145Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["theme"]}
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T191218Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["feat"]}
{"description":"more themes","entry":"20230812T182344Z","modified":"20230812T191228Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["themes"]}
{"description":"styling: apply configurable styles to each field and state with semantics","end":"20230814T051324Z","entry":"20230811T171937Z","modified":"20230814T051324Z","status":"completed","uuid":"17819637-4f4a-4e46-8622-12d8243c54da","tags":["feat"]}
{"description":"more themes","entry":"20230812T182344Z","modified":"20230814T051340Z","start":"20230814T051340Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["themes"]}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T051438Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc"}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T051527Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc","tags":["feat"]}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T051747Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc","tags":["bug","feat"]}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T051936Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc","tags":["feat"]}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T052002Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc","tags":["bug","feat"]}
{"description":"show done: display completed tasks during some days after their completion, but not after","entry":"20230814T051438Z","modified":"20230814T052015Z","status":"pending","uuid":"18b8f46c-3498-4e75-8945-b578beaf29bc","tags":["feat"]}

View file

@ -0,0 +1 @@
[description:"styling: apply configurable styles to each field and state with semantics" end:"1691990004" entry:"1691774377" modified:"1691990004" status:"completed" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]

View file

@ -4,5 +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:"1691785525" start:"1691785525" status:"pending" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
[description:"more themes" entry:"1691864624" modified:"1691867548" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
[description:"more themes" entry:"1691864624" modified:"1691990020" start:"1691990020" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
[description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990415" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]

View file

@ -82,3 +82,34 @@ time 1691867548
old [description:"more themes" entry:"1691864624" modified:"1691867538" status:"pending" tags:"feat" tags_feat:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
new [description:"more themes" entry:"1691864624" modified:"1691867548" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
---
time 1691990004
old [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"]
new [description:"styling: apply configurable styles to each field and state with semantics" end:"1691990004" entry:"1691774377" modified:"1691990004" status:"completed" tags:"feat" tags_feat:"x" uuid:"17819637-4f4a-4e46-8622-12d8243c54da"]
---
time 1691990020
old [description:"more themes" entry:"1691864624" modified:"1691867548" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
new [description:"more themes" entry:"1691864624" modified:"1691990020" start:"1691990020" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
---
time 1691990078
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990078" status:"pending" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---
time 1691990127
old [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990078" status:"pending" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990127" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---
time 1691990267
old [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990127" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990267" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---
time 1691990376
old [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990267" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990376" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---
time 1691990402
old [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990376" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990402" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---
time 1691990415
old [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990402" status:"pending" tags:"bug,feat" tags_bug:"x" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
new [description:"show done: display completed tasks during some days after their completion, but not after" entry:"1691990078" modified:"1691990415" status:"pending" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
---

View file

@ -50,7 +50,7 @@ class task:
super().__init__(show_only, order, group = None, touched = touched)
self.wrap_width = wrap_width
def __call__(self, task):
def _make(self, task):
if not self.show_only:
# Show all existing fields.
self.show_only = task.keys()
@ -58,8 +58,12 @@ class task:
sid = str(task["id"])
if ':' in task["description"]:
short, desc = task["description"].split(":")
title = rich.text.Text(sid, style='id') + ":" + rich.text.Text(short.strip(), style='short_description')
title = rich.text.Text(sid, style='id') + rich.text.Text(":", style="default") + rich.text.Text(short.strip(), style='short_description')
desc = rich.text.Text("\n".join(textwrap.wrap(desc.strip(), self.wrap_width)), style='long_description')
elif len(task["description"]) <= self.wrap_width - 8:
d = task["description"].strip()
title = rich.text.Text(sid, style='id') + rich.text.Text(":", style="default") + rich.text.Text(d, style='short_description')
desc = None
else:
desc = task["description"]
desc = rich.text.Text("\n".join(textwrap.wrap(desc.strip(), self.wrap_width)), style='description')
@ -83,16 +87,45 @@ class task:
# 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,
if desc:
body = rich.console.Group(desc, cols, fit = True)
else:
body = cols
return title,body
def __call__(self, task):
title, body = self._make(task)
sid = str(task["id"])
if sid in self.touched:
panel = rich.panel.Panel(body, title = title,
title_align="left", expand = False, padding = (0,1), border_style = 'touched', box = rich.box.DOUBLE_EDGE)
else:
panel = rich.panel.Panel(grp, title = title,
panel = rich.panel.Panel(body, title = title,
title_align="left", expand = False, padding = (0,1))
return panel
class Sheet(Card):
def __init__(self, show_only, order = None, touched = [], wrap_width = 25):
super().__init__(show_only, order, touched = touched, wrap_width = wrap_width)
def __call__(self, task):
title, body = self._make(task)
t = rich.text.Text("\n", style="") + title + rich.text.Text("")
sid = str(task["id"])
if sid in self.touched:
b = rich.panel.Panel(body, box = rich.box.SIMPLE_HEAD, style='touched')
else:
b = rich.panel.Panel(body, box = rich.box.SIMPLE_HEAD, style='description')
sheet = rich.console.Group(t,b)
return sheet
class Raw(Tasker):
def __init__(self, show_only, order = None, touched = []):
super().__init__(show_only, order, group = None, touched = touched)
@ -305,6 +338,7 @@ def parse_touched(out):
def get_themes(name = None):
themes = {
"none": {
'touched': '',
'id': '',
@ -322,6 +356,7 @@ def get_themes(name = None):
'row_odd': '',
'row_even' : '',
},
"nojhan": {
'touched': '#4E9A06',
'id': 'color(214)',
@ -339,6 +374,25 @@ def get_themes(name = None):
'row_odd': 'on #262121',
'row_even' : 'on #2d2929',
},
"filled": {
'touched': 'color(0) on color(15)',
'id': 'bold color(160) on white',
'title': '',
'description': 'black on white',
'short_description': 'bold black on white',
'long_description': 'black on white',
'entry': '',
'modified': 'color(240)',
'started': '',
'status': 'bold italic white',
'uuid': '',
'tags': 'color(21) on white',
'urgency': 'color(219)',
'row_odd': 'on #262121',
'row_even' : 'on #2d2929',
},
}
if name:
return themes[name]
@ -347,10 +401,12 @@ def get_themes(name = None):
def get_layouts(kind = None, name = None):
# FIXME use introspection to extract that automatically.
available = {
"task": {
"Raw": task.Raw,
"Card": task.Card,
"Sheet": task.Sheet,
},
"stack": {
"RawTable": stack.RawTable,
@ -432,7 +488,7 @@ if __name__ == "__main__":
theme = rich.theme.Theme(get_themes(asked.theme))
layouts = get_layouts()
if asked.layout_task == "Card":
if asked.layout_task == "Card" or asked.layout_task == "Sheet":
tasker = layouts['task'][asked.layout_task](show_only, touched = touched, wrap_width = asked.card_wrap)
else:
tasker = layouts['task'][asked.layout_task](show_only, touched = touched)