From 52ecedd17d7a5c4cd07078f95985bf7ea5456791 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 25 Aug 2023 11:07:16 +0200 Subject: [PATCH] config: add layout.[sub]sections.group.show --- .task/backlog.data | 1 + .task/pending.data | 2 +- .task/undo.data | 4 ++++ taskwarrior-deluxe.py | 30 +++++++++++++++++++++++++----- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.task/backlog.data b/.task/backlog.data index 6284aa8..f3b611a 100644 --- a/.task/backlog.data +++ b/.task/backlog.data @@ -71,3 +71,4 @@ {"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T171624Z","priority":"H","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]} {"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T171646Z","priority":"H","start":"20230821T171646Z","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]} {"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","end":"20230821T171844Z","entry":"20230821T064218Z","modified":"20230821T171844Z","priority":"H","status":"completed","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]} +{"description":"semantic colors: allow coloring by values, not just fields.","entry":"20230817T065528Z","modified":"20230825T084738Z","start":"20230825T084738Z","status":"pending","uuid":"1a5aab4a-0c2b-444f-9259-6eddc29b9791","tags":["feat","themes"]} diff --git a/.task/pending.data b/.task/pending.data index 2ac9c12..2d533a8 100644 --- a/.task/pending.data +++ b/.task/pending.data @@ -4,5 +4,5 @@ [description:"more themes" entry:"1691864624" modified:"1692600330" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"] [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:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692255328" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"] +[description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692953258" start:"1692953258" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"] [description:"theme config: use taskwarrior theme config and extends from there." entry:"1692471868" modified:"1692600275" priority:"H" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"6b248843-1b11-487b-85e8-a96e668f6772"] diff --git a/.task/undo.data b/.task/undo.data index 74ea8d8..5716de9 100644 --- a/.task/undo.data +++ b/.task/undo.data @@ -264,3 +264,7 @@ time 1692638324 old [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638206" priority:"H" start:"1692638206" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"] new [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" end:"1692638324" entry:"1692600138" modified:"1692638324" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"] --- +time 1692953258 +old [description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692255328" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"] +new [description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692953258" start:"1692953258" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"] +--- diff --git a/taskwarrior-deluxe.py b/taskwarrior-deluxe.py index 94c57a9..331e9e6 100755 --- a/taskwarrior-deluxe.py +++ b/taskwarrior-deluxe.py @@ -369,7 +369,11 @@ class group: class sort: class OnValues(SectionSorter): def __init__(self, values): - self.values = values + if values: + self.values = values + else: + print("WARNING: no values.") + self.values = [] def __call__(self): return self.values @@ -695,8 +699,10 @@ if __name__ == "__main__": "layout.stack.sort.reverse": "false", # urgency and priority are numeric. "layout.subsections": "", "layout.subsections.group": "", + "layout.subsections.group.show": "", "layout.sections": "Horizontal", "layout.sections.group": "status", + "layout.sections.group.show": "", "design.swatch": "none", "design.icons": "none", "widget.card.wrap": "25", @@ -774,12 +780,19 @@ if __name__ == "__main__": stacker = layouts['stack'][config["layout.stack"]](tasker, sorter = sorter) if config["layout.sections.group"]: + values = config["layout.sections.group.show"].split(list_separator) + if values == ['']: + values = [] if config["layout.sections.group"].lower() == "status": group_by = group.Status() - g_sort_on = group.sort.OnValues(["pending","started","completed"]) + if not values: + values = ["pending","started","completed"] + g_sort_on = group.sort.OnValues( values ) elif config["layout.sections.group"].lower() == "priority": group_by = group.Field("priority") - g_sort_on = group.sort.OnValues(["H","M","L",""]) + if not values: + values = ["H","M","L",""] + g_sort_on = group.sort.OnValues( values ) else: group_by = group.Field(config["layout.sections.group"]) g_sort_on = None @@ -788,12 +801,19 @@ if __name__ == "__main__": g_sort_on = group.sort.OnValues(["pending","started","completed"]) if config["layout.subsections.group"]: + values = config["layout.subsections.group.show"].split(list_separator) + if values == ['']: + values = [] if config["layout.subsections.group"].lower() == "status": subgroup_by = group.Status() - g_subsort_on = group.sort.OnValues(["pending","started","completed"]) + if not values: + values = ["pending","started","completed"] + g_sort_on = group.sort.OnValues( values ) if config["layout.subsections.group"].lower() == "priority": subgroup_by = group.Field("priority") - g_subsort_on = group.sort.OnValues(["H","M","L",""]) + if not values: + values = ["H","M","L",""] + g_subsort_on = group.sort.OnValues( values ) else: subgroup_by = group.Field(config["layout.subsections.group"]) g_subsort_on = None