Viewing and Filtering your Tree
Liblarch API: 1.0
For each liblarch Tree, you can create as many View as you want. In liblarch, those are called "ViewTree" (not to be mixed with the gtk.TreeView widget). The advantage is that each View can be filtered.
A liblarch Filter is simply a function that take a TreeNode as a parameter and return True if the Node should be displayed with the filter, False otherwise.
EXAMPLE: creating a filter, adding it to a tree, creating a viewtree, applying a filter to it.
A filter is a predicate which decides if node should be shown or hidden. Example of such a filter which displays only active tasks in Getting Things GNOME! is:
Filters can have parameters. It prevents you creating the same filter again and again. In Getting Things GNOME! the user can have many gtags. When she filters tasks by a tag, we apply a general filter with the tag as the parameter:
A flat filter is a special filter. If applied, the final tree will be flat -- just list of nodes. When you want to show tasks which you completed the last week, a float filter is applied because you are not interested in relationships among them. One flat filter is enough to produce list instead of a tree. A flat filter has set parameter 'flat' to True.
A transparent filter is another special filter. It provides you an option to count nodes with all applied filters or only with non-transparent filters.
Let have the following situation: There is a filtering pane which shows the name and the count of nodes for filter. The user chooses a filter and a view is updates. Afterwards the counts of tasks for filters has changed. You do not want to do that. You want to "ignore" the last filter and count without it. There might be a situation when you want to count it. Therefore every time you can choose to use or ignore transparent filterswhen counting.