On Wed, Jul 16, 2025 at 12:02 PM Thomas Passin wrote:
You can come close to simulating some of this because any node can contain
> a list of UNLs. CTRL-Clicking any of them will open that outline and it
> should be easy to write a script to open them all.
>
Yes. But it gets better. See below.
> I foresee some user interface matters to figure out. For example, all
> outlines that are open because their parent outline with an @leo node was
> opened, need to visually show that they are part of a group linked to that
> parent outline. And it has be decided what to do if two Leo outlines get
> opened that contain references to different but overlapping sets of
> outlines.
>
This is probably not necessary because Aha! (In the shower):
>From *any* Leo outline O, it's dead easy to compute the transitive closure
of all outlines reached from O via @leo nodes, *regardless *of the @leo
links in any outline. Arbitrary links are just fine!
Here is the algorithm (*untested!):*
done: list[str] = [c.fileName()] # List of paths already scanned.
todo: list[str] = [] # List of paths to be scanned.
result: list[Commands] = [] # List of all commanders reachable via @leo
nodes from c.
def scan(fileName):
"""
Add all nodes not already seen to the todo list.
Add all to-be-scanned Commanders to the result list.
"""
for p in c.all_unique_positions():
if p.isAnyAtLeoNode(): # this method doesn't exist yet.
fileName = p.isAtLeoFileName() # this method doesn't exist
yet.
if fileName not in todo and fileName not in done:
c2 = g.openWithFileName(fileName())
todo.append(fileName)
assert c2 not in result
result.append(c2)
# Create the initial to-do list.
scan(c.fileName())
# Rescan until the to-do list is empty.
while todo:
fileName = todo.pop()
if fileName not in done:
done.append(fileName)
scan(fileName)
# We probably want to remove c from the result.
result.remove(c)
# And we might want (eventually) to close all the commanders in the result
list!
*Conclusion*
@leo nodes can create arbitrary graphs without *any* complications!!
A straightforward algorithm (prototyped above) creates the transitive
closure of all commanders reached from any outline O via @leo nodes. This
algorithm will be essentially the same even if commanders are in different
processes.
Edward
--
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 view this discussion visit
https://groups.google.com/d/msgid/leo-editor/CAMF8tS0b45NV44ub60jNNOCwCcHu%3D0aRh%2BuyHaMPN6BQTuicvQ%40mail.gmail.com.