On Sat, 10 Jul 2010 12:11:35 -0400
Brian Theado <[email protected]> wrote:

> On Wed, Jul 7, 2010 at 11:27 PM, Terry Brown <[email protected]> wrote:
> > There's also plugins/leocursor.py and the example referenced from that 
> > file.  From memory:
> 
> I had seen the somewhat similar functionality in iLeo, but not
> leocursor.  Thanks for the pointer.
> 
> > lc.Events[0].start_time == start_time attribute embedded in body text (or 
> > unknownAttributes) of first Events child
> >
> > lc.Contact.Email == Email node under Contact node under Website node.
> 
> For these examples, how does the code know whether to retrieve an
> attribute vs. retrieving a child node?

That's probably not well doc'ed.  I think it tries for a child node first, and 
the attribute if it doesn't find the child node.  Also foo._bar will look for 
child node `_bar`, then attribute `_bar` (I think), and then attribute `bar`, 
i.e. without the leading underscore.  And of course the foo("@bar") format is 
unambiguous.

> I noticed in your examples file that the attribute access does not
> refer to attributes on Leo's tree, but rather attributes defined in
> body text using a particular syntax.  that seems useful.  Having the
> attributes hidden in the node would not have been easy for the user to
> edit (unless Leo has a plugin that allows arbitrary editing of node
> attributes).

Actually leoscreen imports an attribute manager from attribEdit.py (or 
something like that) which lets you edit in a uniform gui attributes stored in 
the body text (various formats), in the nodes uA dictionary, and as subnodes of 
the current node.

> The code I shared has different intent than leocursor.  Leocursor
> seems focused mainly on descending the tree whereas the code I shared
> is about surfing along any axis in the tree.

I did just add a _P parent list attribute to leocursor, so XPath's '..' would 
be '.P[-1]', but yes, leocursor is more for clean concise handling of informal 
but relatively consistent records than arbitrary tree walking.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to