Skip to content

Commit e1cc2ce

Browse files
committed
Show the expander for tasks only when a matching child exists
Fixes the rest of GitHub issue #1207
1 parent 83059e3 commit e1cc2ce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

GTG/core/tasks.py

+4
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,10 @@ def get_tree_model(self):
710710
return self.tree_model
711711

712712

713+
def has_matching_children(self,task:Task):
714+
return any(self.task_filter.do_match(c) for c in task.children)
715+
716+
713717
def set_filter(self,new_filter:Gtk.Filter):
714718
self.task_filter = new_filter
715719
self.task_filter.connect('changed',self._on_changed)

GTG/gtk/browser/task_pane.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ def show_start(binding, value, user_data=None):
506506

507507
listitem.bindings = [
508508
item.bind_property('has_children', box, 'has_children', BIND_FLAGS),
509-
item.bind_property('has_children', expander, 'hide-expander', BIND_FLAGS,lambda _,x: not x),
509+
item.bind_property('has_children', expander, 'hide-expander', BIND_FLAGS
510+
,lambda _,x: not self.filter_manager.has_matching_children(item)),
510511

511512
item.bind_property('title', label, 'label', BIND_FLAGS),
512513
item.bind_property('excerpt', box, 'tooltip-text', BIND_FLAGS),

0 commit comments

Comments
 (0)