Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always show tags with zero tasks #1100

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions GTG/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion GTG/gtk/browser/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down