On Thu, Feb 25, 2016 at 6:42 PM, Richard Andersen <monta...@gmail.com> wrote:
> What I'd like to do next is to use the Clone Find All Flattened command to find all my Nodes which are "open tasks" ... Use c.cloneFindByPredicate. Like this (tested code): tc = c.theTagController def isOpenTask(p): tags = tc.get_tags(p) return 'open' in tags and 'todo' in tags c.cloneFindByPredicate( generator = c.all_unique_positions, predicate = isOpenTask, flatten = True, undoType = 'clone-open-tasks', ) > Ideally, these would be shown in context with the parent tags down to the "found" tags . An interesting problem. It just needs a different predicate. Here is tested code: tc = c.theTagController def hasOpenTask(p): '''Return True if p is a top-level node containing any open task.''' if p.parent(): return False # Not a top-level node. for p2 in p.self_and_subtree(): tags = tc.get_tags(p2) if 'open' in tags and 'todo' in tags: return True # p, the ultimate parent, has an open task within. else: return False c.cloneFindByPredicate( generator = c.all_unique_positions, predicate = hasOpenTask, flatten = True, undoType = 'clone-trees-with-open-tasks', ) I'm not sure this is all that useful, but it's what you *said* you wanted, hehe. In any case, I hope this convinces you that predicates rock. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.