allow sorting within stacker
This commit is contained in:
parent
1a6f6c0ece
commit
c72a0d68be
5 changed files with 130 additions and 55 deletions
|
|
@ -42,3 +42,8 @@
|
||||||
{"description":"subgrouping: allow to add another sectionning, e.g. based on priority.","entry":"20230815T180428Z","modified":"20230815T180440Z","start":"20230815T180440Z","status":"pending","uuid":"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a","tags":["feat"]}
|
{"description":"subgrouping: allow to add another sectionning, e.g. based on priority.","entry":"20230815T180428Z","modified":"20230815T180440Z","start":"20230815T180440Z","status":"pending","uuid":"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a","tags":["feat"]}
|
||||||
{"description":"sorting: allow sorting within a stacker.","entry":"20230816T115710Z","modified":"20230816T115710Z","status":"pending","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
{"description":"sorting: allow sorting within a stacker.","entry":"20230816T115710Z","modified":"20230816T115710Z","status":"pending","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
||||||
{"description":"subgrouping: allow to add another sectionning, e.g. based on priority.","end":"20230816T115728Z","entry":"20230815T180428Z","modified":"20230816T115728Z","status":"completed","uuid":"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a","tags":["feat"]}
|
{"description":"subgrouping: allow to add another sectionning, e.g. based on priority.","end":"20230816T115728Z","entry":"20230815T180428Z","modified":"20230816T115728Z","status":"completed","uuid":"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a","tags":["feat"]}
|
||||||
|
{"description":"sorting: allow sorting within a stacker.","end":"20230816T183233Z","entry":"20230816T115710Z","modified":"20230816T183233Z","status":"completed","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
||||||
|
{"description":"sorting: allow sorting within a stacker.","entry":"20230816T115710Z","modified":"20230816T115710Z","status":"pending","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
||||||
|
{"description":"sorting: allow sorting within a stacker.","entry":"20230816T115710Z","modified":"20230816T193453Z","start":"20230816T193453Z","status":"pending","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
||||||
|
{"description":"sorting: allow sorting within a stacker.","end":"20230816T193508Z","entry":"20230816T115710Z","modified":"20230816T193508Z","status":"completed","uuid":"30ec6b32-a32e-4595-a24d-02ac9002fd72","tags":["feat"]}
|
||||||
|
{"description":"sort by urgency","end":"20230816T193637Z","entry":"20230811T170942Z","modified":"20230816T193637Z","priority":"H","status":"completed","uuid":"4f041f52-739a-4aca-94e6-164f43e61866","tags":["feat"]}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
[description:"sort by urgency" end:"1692214597" entry:"1691773782" modified:"1692214597" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||||
|
[description:"sorting: allow sorting within a stacker." end:"1692214508" entry:"1692187030" modified:"1692214508" status:"completed" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
||||||
[description:"subgrouping: allow to add another sectionning, e.g. based on priority." end:"1692187048" entry:"1692122668" modified:"1692187048" status:"completed" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
[description:"subgrouping: allow to add another sectionning, e.g. based on priority." end:"1692187048" entry:"1692122668" modified:"1692187048" status:"completed" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
||||||
[description:"show done: display completed tasks during some days after their completion, but not after" end:"1692122556" entry:"1691990078" modified:"1692122561" status:"deleted" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
|
[description:"show done: display completed tasks during some days after their completion, but not after" end:"1692122556" entry:"1691990078" modified:"1692122561" status:"deleted" tags:"feat" tags_feat:"x" uuid:"18b8f46c-3498-4e75-8945-b578beaf29bc"]
|
||||||
[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"]
|
[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"]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
[description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692121517" priority:"H" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"]
|
[description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692121517" priority:"H" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"]
|
||||||
[description:"semantic tags : allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1692121563" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
[description:"semantic tags : allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1692121563" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
[description:"hide old done tasks: Hide tasks with last status that haven t been touched since a long time." entry:"1691773751" modified:"1692122496" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"]
|
[description:"hide old done tasks: Hide tasks with last status that haven t been touched since a long time." entry:"1691773751" modified:"1692122496" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"]
|
||||||
[description:"sort by urgency" entry:"1691773782" modified:"1692122485" priority:"H" 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:"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:"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:"more themes" entry:"1691864624" modified:"1691990020" start:"1691990020" 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:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692121630" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"]
|
[description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692121630" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"]
|
||||||
[description:"colored panels: allow selecting a different swatch for each &open;sub&close;panel" entry:"1692122434" modified:"1692122452" priority:"M" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"ca17838d-958f-498b-bff5-a24576820ae7"]
|
[description:"colored panels: allow selecting a different swatch for each &open;sub&close;panel" entry:"1692122434" modified:"1692122452" priority:"M" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"ca17838d-958f-498b-bff5-a24576820ae7"]
|
||||||
[description:"handle prompts: for some commands like delete, taskwarrior setup an interactive prompt, which needs to be handled." entry:"1692122614" modified:"1692122614" status:"pending" tags:"bug" tags_bug:"x" uuid:"e2480c4b-4c73-4d03-8568-82f14ade7b38"]
|
[description:"handle prompts: for some commands like delete, taskwarrior setup an interactive prompt, which needs to be handled." entry:"1692122614" modified:"1692122614" status:"pending" tags:"bug" tags_bug:"x" uuid:"e2480c4b-4c73-4d03-8568-82f14ade7b38"]
|
||||||
[description:"sorting: allow sorting within a stacker." entry:"1692187030" modified:"1692187030" status:"pending" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
|
||||||
|
|
|
||||||
|
|
@ -160,3 +160,15 @@ time 1692187048
|
||||||
old [description:"subgrouping: allow to add another sectionning, e.g. based on priority." entry:"1692122668" modified:"1692122680" start:"1692122680" status:"pending" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
old [description:"subgrouping: allow to add another sectionning, e.g. based on priority." entry:"1692122668" modified:"1692122680" start:"1692122680" status:"pending" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
||||||
new [description:"subgrouping: allow to add another sectionning, e.g. based on priority." end:"1692187048" entry:"1692122668" modified:"1692187048" status:"completed" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
new [description:"subgrouping: allow to add another sectionning, e.g. based on priority." end:"1692187048" entry:"1692122668" modified:"1692187048" status:"completed" tags:"feat" tags_feat:"x" uuid:"9dc6d43a-b316-4417-ad2a-e47b8a5ddc7a"]
|
||||||
---
|
---
|
||||||
|
time 1692214493
|
||||||
|
old [description:"sorting: allow sorting within a stacker." entry:"1692187030" modified:"1692187030" status:"pending" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
||||||
|
new [description:"sorting: allow sorting within a stacker." entry:"1692187030" modified:"1692214493" start:"1692214493" status:"pending" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
||||||
|
---
|
||||||
|
time 1692214508
|
||||||
|
old [description:"sorting: allow sorting within a stacker." entry:"1692187030" modified:"1692214493" start:"1692214493" status:"pending" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
||||||
|
new [description:"sorting: allow sorting within a stacker." end:"1692214508" entry:"1692187030" modified:"1692214508" status:"completed" tags:"feat" tags_feat:"x" uuid:"30ec6b32-a32e-4595-a24d-02ac9002fd72"]
|
||||||
|
---
|
||||||
|
time 1692214597
|
||||||
|
old [description:"sort by urgency" entry:"1691773782" modified:"1692122485" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||||
|
new [description:"sort by urgency" end:"1692214597" entry:"1691773782" modified:"1692214597" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||||
|
---
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,41 @@ from rich.console import Console
|
||||||
from rich.columns import Columns
|
from rich.columns import Columns
|
||||||
|
|
||||||
class Widget:
|
class Widget:
|
||||||
def __init__(self, order, group = None):
|
pass
|
||||||
|
|
||||||
|
class Tasker(Widget):
|
||||||
|
def __init__(self, show_only, order = None, group = None, touched = []):
|
||||||
|
self.show_only = show_only
|
||||||
|
self.touched = touched
|
||||||
|
self.sorter = order
|
||||||
|
self.grouper = group
|
||||||
|
|
||||||
|
def __call__(self, task):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class Stacker(Widget):
|
||||||
|
def __init__(self, tasker, sorter = None):
|
||||||
|
self.tasker = tasker
|
||||||
|
if sorter:
|
||||||
|
self.sorter = sorter
|
||||||
|
else:
|
||||||
|
self.sorter = stack.sort.Noop()
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class StackSorter:
|
||||||
|
def __init__(self, field, reverse = False):
|
||||||
|
self.field = field
|
||||||
|
self.reverse = reverse
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
class Sectioner(Widget):
|
||||||
|
def __init__(self, stacker, order, group):
|
||||||
|
self.stacker = stacker
|
||||||
self.sorter = order
|
self.sorter = order
|
||||||
self.grouper = group
|
self.grouper = group
|
||||||
|
|
||||||
|
|
@ -30,28 +64,6 @@ class Widget:
|
||||||
else:
|
else:
|
||||||
return {"":tasks}
|
return {"":tasks}
|
||||||
|
|
||||||
class Tasker(Widget):
|
|
||||||
def __init__(self, show_only, order, group = None, touched = []):
|
|
||||||
super().__init__(order, group)
|
|
||||||
self.show_only = show_only
|
|
||||||
self.touched = touched
|
|
||||||
|
|
||||||
def __call__(self, task):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
class Stacker(Widget):
|
|
||||||
def __init__(self, tasker, order, group):
|
|
||||||
super().__init__(order, group)
|
|
||||||
self.tasker = tasker
|
|
||||||
|
|
||||||
def __call__(self, tasks):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
class Sectioner(Widget):
|
|
||||||
def __init__(self, stacker, order, group):
|
|
||||||
super().__init__(order, group)
|
|
||||||
self.stacker = stacker
|
|
||||||
|
|
||||||
def __call__(self, tasks):
|
def __call__(self, tasks):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
@ -169,9 +181,42 @@ class task:
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
class stack:
|
class stack:
|
||||||
|
class sort:
|
||||||
|
class Noop(StackSorter):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(None)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
return tasks
|
||||||
|
|
||||||
|
class Field(StackSorter):
|
||||||
|
def __init__(self, field, reverse = False):
|
||||||
|
super().__init__(field, reverse)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
def field_or_not(task):
|
||||||
|
if self.field in task:
|
||||||
|
return task[self.field]
|
||||||
|
else:
|
||||||
|
return "XXX" # No field comes last.
|
||||||
|
return sorted(tasks, key = field_or_not, reverse = self.reverse)
|
||||||
|
|
||||||
|
class Priority(StackSorter):
|
||||||
|
def __init__(self, reverse = False):
|
||||||
|
super().__init__("priority", reverse)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
def p_value(task):
|
||||||
|
p_values = {'H': 0, 'M': 1, 'L': 2, '': 3}
|
||||||
|
if self.field in task:
|
||||||
|
return p_values[task[self.field]]
|
||||||
|
else:
|
||||||
|
return p_values['']
|
||||||
|
return sorted(tasks, key = p_value, reverse = self.reverse)
|
||||||
|
|
||||||
class RawTable(Stacker):
|
class RawTable(Stacker):
|
||||||
def __init__(self, tasker):
|
def __init__(self, tasker, sorter = None):
|
||||||
super().__init__(tasker, order = None, group = None)
|
super().__init__(tasker, sorter = sorter)
|
||||||
|
|
||||||
def __call__(self, tasks):
|
def __call__(self, tasks):
|
||||||
keys = self.tasker.show_only
|
keys = self.tasker.show_only
|
||||||
|
|
@ -181,7 +226,7 @@ class stack:
|
||||||
for k in keys:
|
for k in keys:
|
||||||
table.add_column(k)
|
table.add_column(k)
|
||||||
|
|
||||||
for task in tasks:
|
for task in self.sorter(tasks):
|
||||||
taskers = self.tasker(task)
|
taskers = self.tasker(task)
|
||||||
if str(task['id']) in self.tasker.touched:
|
if str(task['id']) in self.tasker.touched:
|
||||||
row = [rich.text.Text('▶', style = 'touched')]
|
row = [rich.text.Text('▶', style = 'touched')]
|
||||||
|
|
@ -217,23 +262,23 @@ class stack:
|
||||||
|
|
||||||
|
|
||||||
class Vertical(Stacker):
|
class Vertical(Stacker):
|
||||||
def __init__(self, tasker):
|
def __init__(self, tasker, sorter = None):
|
||||||
super().__init__(tasker, order = None, group = None)
|
super().__init__(tasker, sorter = sorter)
|
||||||
|
|
||||||
def __call__(self, tasks):
|
def __call__(self, tasks):
|
||||||
stack = rich.table.Table(box = None, show_header = False, show_lines = False, expand = True)
|
stack = rich.table.Table(box = None, show_header = False, show_lines = False, expand = True)
|
||||||
stack.add_column("Tasks")
|
stack.add_column("Tasks")
|
||||||
for task in tasks:
|
for task in self.sorter(tasks):
|
||||||
stack.add_row( self.tasker(task) )
|
stack.add_row( self.tasker(task) )
|
||||||
return stack
|
return stack
|
||||||
|
|
||||||
class Flat(Stacker):
|
class Flat(Stacker):
|
||||||
def __init__(self, tasker):
|
def __init__(self, tasker, sorter = None):
|
||||||
super().__init__(tasker, order = None, group = None)
|
super().__init__(tasker, sorter = sorter)
|
||||||
|
|
||||||
def __call__(self, tasks):
|
def __call__(self, tasks):
|
||||||
stack = []
|
stack = []
|
||||||
for task in tasks:
|
for task in self.sorter(tasks):
|
||||||
stack.append( self.tasker(task) )
|
stack.append( self.tasker(task) )
|
||||||
cols = rich.columns.Columns(stack)
|
cols = rich.columns.Columns(stack)
|
||||||
return cols
|
return cols
|
||||||
|
|
@ -276,17 +321,6 @@ class SectionSorter:
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
class sort:
|
|
||||||
# def make(self, tasks, field, reverse = False):
|
|
||||||
# return sorted(tasks, key = lambda t: t[field], reverse = reverse)
|
|
||||||
|
|
||||||
class OnValues(SectionSorter):
|
|
||||||
def __init__(self, values):
|
|
||||||
self.values = values
|
|
||||||
|
|
||||||
def __call__(self):
|
|
||||||
return self.values
|
|
||||||
|
|
||||||
class Grouper:
|
class Grouper:
|
||||||
"""Group tasks by field values."""
|
"""Group tasks by field values."""
|
||||||
def __init__(self, field):
|
def __init__(self, field):
|
||||||
|
|
@ -308,6 +342,14 @@ class Grouper:
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
class group:
|
class group:
|
||||||
|
class sort:
|
||||||
|
class OnValues(SectionSorter):
|
||||||
|
def __init__(self, values):
|
||||||
|
self.values = values
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
return self.values
|
||||||
|
|
||||||
class Field(Grouper):
|
class Field(Grouper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -524,7 +566,7 @@ if __name__ == "__main__":
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument("-s", "--show", metavar="columns", type=str, default="id,priority,description,tags", nargs=1,
|
parser.add_argument("-s", "--show", metavar="columns", type=str, default="id,priority,description,tags",
|
||||||
help="Ordered list of columns to show.")
|
help="Ordered list of columns to show.")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -554,6 +596,12 @@ if __name__ == "__main__":
|
||||||
layouts_grp.add_argument('-G', '--subgroup-by', metavar="NAME", type=str, default=None,
|
layouts_grp.add_argument('-G', '--subgroup-by', metavar="NAME", type=str, default=None,
|
||||||
help="Create sub-sections by grouping on this field.")
|
help="Create sub-sections by grouping on this field.")
|
||||||
|
|
||||||
|
layouts_grp.add_argument('-S', '--sort', metavar="NAME", type=str, default='urgency',
|
||||||
|
help="Field on which to sort tasks in a stack.")
|
||||||
|
|
||||||
|
layouts_grp.add_argument('-R', '--reverse', action = 'store_true',
|
||||||
|
help="Reverse the sort of tasks in a stack.")
|
||||||
|
|
||||||
layouts_grp.add_argument('-T', '--swatch', metavar='NAME', type=str, default='none',
|
layouts_grp.add_argument('-T', '--swatch', metavar='NAME', type=str, default='none',
|
||||||
choices = get_swatches().keys(), help="Color chart.")
|
choices = get_swatches().keys(), help="Color chart.")
|
||||||
|
|
||||||
|
|
@ -580,6 +628,7 @@ if __name__ == "__main__":
|
||||||
jdata = get_data()
|
jdata = get_data()
|
||||||
# print(json.dumps(jdata, indent=4))
|
# print(json.dumps(jdata, indent=4))
|
||||||
|
|
||||||
|
print(asked.show)
|
||||||
showed = asked.show.split(asked.list_separator)
|
showed = asked.show.split(asked.list_separator)
|
||||||
if not showed:
|
if not showed:
|
||||||
show_only = None
|
show_only = None
|
||||||
|
|
@ -597,41 +646,50 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
tasker = layouts['task'][asked.layout_task](show_only, touched = touched)
|
tasker = layouts['task'][asked.layout_task](show_only, touched = touched)
|
||||||
|
|
||||||
stacker = layouts['stack'][asked.layout_stack](tasker)
|
if asked.sort:
|
||||||
|
if asked.sort == "priority":
|
||||||
|
sorter = stack.sort.Priority(asked.reverse)
|
||||||
|
elif asked.sort == "urgency":
|
||||||
|
sorter = stack.sort.Priority(asked.reverse)
|
||||||
|
else:
|
||||||
|
sorter = stack.sort.Field(asked.sort, reverse = asked.reverse)
|
||||||
|
else:
|
||||||
|
sorter = None
|
||||||
|
stacker = layouts['stack'][asked.layout_stack](tasker, sorter = sorter)
|
||||||
|
|
||||||
if asked.group_by:
|
if asked.group_by:
|
||||||
if asked.group_by.lower() == "status":
|
if asked.group_by.lower() == "status":
|
||||||
group_by = group.Status()
|
group_by = group.Status()
|
||||||
sort_on = sort.OnValues(["pending","started","completed"])
|
g_sort_on = group.sort.OnValues(["pending","started","completed"])
|
||||||
elif asked.group_by.lower() == "priority":
|
elif asked.group_by.lower() == "priority":
|
||||||
group_by = group.Field("priority")
|
group_by = group.Field("priority")
|
||||||
sort_on = sort.OnValues(["H","M","L",""])
|
g_sort_on = group.sort.OnValues(["H","M","L",""])
|
||||||
else:
|
else:
|
||||||
group_by = group.Field(asked.group_by)
|
group_by = group.Field(asked.group_by)
|
||||||
sort_on = None
|
g_sort_on = None
|
||||||
else:
|
else:
|
||||||
group_by = group.Status()
|
group_by = group.Status()
|
||||||
sort_on = sort.OnValues(["pending","started","completed"])
|
g_sort_on = group.sort.OnValues(["pending","started","completed"])
|
||||||
|
|
||||||
if asked.subgroup_by:
|
if asked.subgroup_by:
|
||||||
if asked.subgroup_by.lower() == "status":
|
if asked.subgroup_by.lower() == "status":
|
||||||
subgroup_by = group.Status()
|
subgroup_by = group.Status()
|
||||||
subsort_on = sort.OnValues(["pending","started","completed"])
|
g_subsort_on = group.sort.OnValues(["pending","started","completed"])
|
||||||
if asked.subgroup_by.lower() == "priority":
|
if asked.subgroup_by.lower() == "priority":
|
||||||
subgroup_by = group.Field("priority")
|
subgroup_by = group.Field("priority")
|
||||||
subsort_on = sort.OnValues(["H","M","L",""])
|
g_subsort_on = group.sort.OnValues(["H","M","L",""])
|
||||||
else:
|
else:
|
||||||
subgroup_by = group.Field(asked.subgroup_by)
|
subgroup_by = group.Field(asked.subgroup_by)
|
||||||
subsort_on = None
|
g_subsort_on = None
|
||||||
else:
|
else:
|
||||||
subgroup_by = None
|
subgroup_by = None
|
||||||
subsort_on = None
|
g_subsort_on = None
|
||||||
|
|
||||||
if asked.layout_subsections and asked.subgroup_by:
|
if asked.layout_subsections and asked.subgroup_by:
|
||||||
subsectioner = layouts['sections'][asked.layout_subsections](stacker, subsort_on, subgroup_by)
|
subsectioner = layouts['sections'][asked.layout_subsections](stacker, g_subsort_on, subgroup_by)
|
||||||
sectioner = layouts['sections'][asked.layout_sections](subsectioner, sort_on, group_by)
|
sectioner = layouts['sections'][asked.layout_sections](subsectioner, g_sort_on, group_by)
|
||||||
else:
|
else:
|
||||||
sectioner = layouts['sections'][asked.layout_sections](stacker, sort_on, group_by)
|
sectioner = layouts['sections'][asked.layout_sections](stacker, g_sort_on, group_by)
|
||||||
|
|
||||||
console = Console(theme = swatch)
|
console = Console(theme = swatch)
|
||||||
# console.rule("taskwarrior-deluxe")
|
# console.rule("taskwarrior-deluxe")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue