@@ -13,7 +13,7 @@ class OrgTree:
1313
1414 If there are multiple level-one headings---with a single asterisk---they
1515 will be stored in the 'children' attribute. The tasks from the children
16- will be merged into the 'all ' attribute.
16+ will be merged into the 'active ' attribute.
1717
1818 Args:
1919 orgfile (str): full pathname of the org file
@@ -22,7 +22,7 @@ class OrgTree:
2222 **kwargs: dictionary containing the command-line arguments
2323
2424 Attributes:
25- all (list): dicts of all active (incomplete) tasks (from all children)
25+ active (list): dicts of all active (incomplete) tasks (from all children)
2626 properties (dict): contains file-wide variables and the CLI options
2727 children (list): list of 'OrgNode' objects
2828 data (str): string containing all text in the org file
@@ -103,13 +103,9 @@ def parse(self):
103103
104104 def merge_children (self ):
105105 """Join the active tasks from all children."""
106- self .all = []
107- if self .properties ['cli' ]['colors' ]:
108- for ch in self .children :
109- self .all += ch .colored
110- else :
111- for ch in self .children :
112- self .all += ch .active
106+ self .active = []
107+ for ch in self .children :
108+ self .active += ch .active
113109
114110#===============================================================================
115111# Class definition for an org "node", a single hierarchy (starting at any level)
@@ -167,8 +163,6 @@ def __init__(self, data, **properties):
167163 for p in ['agenda' , 'states' , 'tags' , 'categories' ]:
168164 if self .properties ['cli' ][p ]:
169165 self .subset_by (p )
170- if self .properties ['cli' ]['colors' ]:
171- self .colorize ()
172166
173167 #-------------------------------------------------------
174168 # Class methods
@@ -283,13 +277,6 @@ def subset_by(self, type_):
283277
284278 self .active = todos
285279
286- # Apply styles to each active task
287- def colorize (self ):
288- """Colorize dates, tags, TODO states, and inline text."""
289- self .colored = []
290- for d in self .active :
291- self .colored .append (utils .colorize (d ))
292-
293280#-----------------------------------------------------------
294281# Loop through all 'org' files listed in 'vimrc'
295282#-----------------------------------------------------------
@@ -305,7 +292,15 @@ def orgTreeFromFile(**kwargs):
305292 todolist = []
306293 for f in orgfiles :
307294 org = OrgTree (f , todostates , ** kwargs )
308- todolist += org .all
295+ todolist += org .active
296+
297+ # Colorize all tasks
298+ if kwargs ['colors' ]:
299+ colored = []
300+ for x in todolist :
301+ colored .append (utils .colorize (x ))
302+
303+ todolist = colored
309304
310305 # Add dates even if there are no tasks, and add future deadlines for "today"
311306 if kwargs ['agenda' ]:
0 commit comments