The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Today's Posts

 
Hierarchical List of Cells Matching a Condition Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
I will go off and think about this some more. My first concern is that this doesn't really help, because now I have a flat list of ancestors that is unique, but I don't know the hierarchy of the ancestors, so I'll have to process them all again to figure out the hierarchy. Might as well to have just built up my own tree...?

Code:
class TreeObj: 
  """Hold a pointer to a row object and its children. Create a tree mirroring OmniOutliner structs"""

  def __init__(self, o, is_row=0):
    self.obj = o
    self.children = []
    self.hidden = 0
    self.is_row = is_row

  def init_tree(self):
    """Recursively initialize a tree of python objects initialized from OmniOutliner doc"""
    for c_apple in self.obj.children():
      c = TreeObj(c_apple, 1) 
      c.init_tree()
      self.children.append(c)

  def find_row(self, pattern):
    retval = 0
    if (self.is_row and not self.hidden):
      for cell in self.obj.cells():
        if (re.search(pattern, str(cell.value()))):
          #print "found pattern " + pattern
          return 1

    for child in self.children:
      if (1 == child.find_row(pattern)):
        retval = 1

    if (retval == 0):
      self.hidden = 1

    return retval

# ... etc
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Completion Cells leanda OmniFocus 2 for Mac (Private Test) 1 2013-04-08 09:17 PM
Selecting projects from a hierarchical list Stephen Brown OmniFocus for iPad 5 2012-09-03 08:50 PM
Merging Cells ktozawa OmniGraffle General 2 2011-04-29 12:52 PM
Merge cells in a row sauron93 OmniOutliner 3 for Mac 0 2009-03-05 03:22 PM
Bug or feature?: Non-matching items eronel OmniFocus 1 for Mac 8 2007-11-26 05:38 PM


All times are GMT -8. The time now is 07:52 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.