On Sat, 14 Nov 2015 11:34:52 -0800 (PST)
john lunzer <[email protected]> wrote:
> I wouldn't mind at least taking a glance at your unused code. I
> really would like a fully collapsible tree and again, Leo seems like
> a natural fit. This wouldn't be much trouble to write myself, however
> if there is some code floating around that I can edit that would be
> nice.
Well that was educational - sure I'll post it, just let me test it,
introspect c... crash... huh? I'm sure I've introspected c before, so
I don't know what's changed to stop it working.
TL;DR: c == c.p should return False, not raise AttributeError, fixed on
trunk now.
Problem is that the code checks for objects already seen in the tree of
objects, and just links (UNL @bookmark) back up the tree, rather than
letting you endlessly expand a tree in a recursion loop, even though
it's only one level at a time, so not a crash, just a trap for the user.
Why it's changed, I don't know, but now when it does this:
for up in tnd.self_and_parents():
if (hasattr(up.v, '_introspection_target') and
getattr(up.v, '_introspection_target') == o):
break
for c -> c.p, it tries c == c.p, no such operator, so then it tries
c.p == c, because
https://docs.python.org/2/reference/datamodel.html#object.__eq__
and that was not checking that "the other" was also a position.
Anyway, code's at
https://github.com/leo-editor/snippets/blob/master/introspect.py
Cheers -Terry
> On Saturday, November 14, 2015 at 12:01:17 PM UTC-5, Terry Brown
> wrote:
> >
> > On Sat, 14 Nov 2015 08:20:51 -0800 (PST)
> > john lunzer <[email protected] <javascript:>> wrote:
> >
> > > I tried to search the forums but the google groups search is the
> > > worst.
> > >
> > > Has there been any work done to import JSON files as a Leo tree?
> > >
> > > My idea is that each node would have a headline and an empty body
> > > until the JSON structure got down to the deepest level of
> > > nesting, in which case the last nested level would be the body
> > > for the previous level as the headline?
> >
> > If you want to view JSON this Chrome extension is nice:
> >
> > https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
> >
> >
> > I have some unshared :-/ code that uses Leo's tree for
> > introspection, so if it made sense to "instantiate" the json, that
> > approach could be used.
> >
> > Cheers -Terry
> >
> > > Any insights would be appreciated. Or if there are free JSON file
> > > viewers that support a collapsible and malleable tree view (for
> > > windows) I guess that would work, but Leo seems uniquely
> > > qualified to handle this task.
> > >
> >
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.