From bfcb78a8ab908edf688c8b62eff898ebf767d5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csaba=20Gy=C3=B6rgyi?= Date: Sat, 11 May 2024 11:24:19 +0200 Subject: [PATCH] Always show tags with zero tasks. 'TagEmptyFilter' checks for the correct 'self.pane' values and considers the newly introduced 'show_zero' field. This fixes GitHub issue #1007 --- GTG/core/filters.py | 13 +++++++------ GTG/gtk/browser/sidebar.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/GTG/core/filters.py b/GTG/core/filters.py index 84a3f3f14..ba02c635a 100644 --- a/GTG/core/filters.py +++ b/GTG/core/filters.py @@ -42,19 +42,20 @@ def __init__(self, ds, pane): super(TagEmptyFilter, self).__init__() self.ds = ds self.pane = pane + self.show_zero = True def do_match(self, item) -> bool: tag = unwrap(item, Tag) - if self.pane == 'open': - return tag.task_count_open > 0 + if self.pane == 'open_view': + return self.show_zero or tag.task_count_open > 0 - elif self.pane == 'closed': - return tag.task_count_closed > 0 + elif self.pane == 'closed_view': + return self.show_zero or tag.task_count_closed > 0 - elif self.pane == 'workview': - return tag.task_count_actionable > 0 and tag.actionable + elif self.pane == 'actionable_view': + return (self.show_zero or tag.task_count_actionable > 0) and tag.actionable else: return True diff --git a/GTG/gtk/browser/sidebar.py b/GTG/gtk/browser/sidebar.py index 65793dd02..43580d2d7 100644 --- a/GTG/gtk/browser/sidebar.py +++ b/GTG/gtk/browser/sidebar.py @@ -146,7 +146,7 @@ def __init__(self, app, ds: Datastore, browser): # ------------------------------------------------------------------------------- # Tags Section # ------------------------------------------------------------------------------- - self.tags_filter = TagEmptyFilter(ds, 'open') + self.tags_filter = TagEmptyFilter(ds, 'open_view') self.filtered_tags = Gtk.FilterListModel() self.filtered_tags.set_model(ds.tags.tree_model) self.filtered_tags.set_filter(self.tags_filter)