Progress report: new layouts

47 views
Skip to first unread message

Edward K. Ream

unread,
Jul 28, 2024, 11:32:19 AM7/28/24
to leo-editor
PR #4017 has passed an important milestone. It contains working layout-creation methods for Leo's legacy and "big-tree" layouts.

See the first comment of the PR for an overview of the changes.

Important: the PR will restart Leo if the user executes the reload-settings command after changing the @string qt-layout-name setting. This scheme sidesteps the difficult (intractable?) problem of undoing Qt layouts.

Suppose that a Leonista wants to use multiple layouts in an outline. This happens when developing layouts. It would be clumsy to change the qt-layout-name setting. Happily, @button nodes can easily change layouts! Here are two tested examples:

@button legacy

h = '@string qt-layout-name'
layout = 'legacy'
p = g.findNodeAnywhere(c, h, exact=False)
if p and p.h.endswith(f" {layout}"):
    g.es_print('no change')
else:
    p.h = f"{h} = {layout}"
    c.save()
    c.doCommandByName('restart-leo')

@button big-tree

h = '@string qt-layout-name'
layout = 'big-tree'
p = g.findNodeAnywhere(c, h, exact=False)
if p and p.h.endswith(f" {layout}"):
    g.es_print('no change')
else:
    p.h = f"{h} = {layout}"
    c.save()
    c.doCommandByName('restart-leo')

The only difference between the two scripts is the name of the layout.

Edward

Thomas Passin

unread,
Jul 28, 2024, 12:59:32 PM7/28/24
to leo-editor
I don't think that restarting Leo is always called for.  A user might change the layout only for certain outlines.  I do that all the time. If there has to be a restart process, then if the default layout is in the settings for a specific outline, then only that outline needs to be restarted.

Edward K. Ream

unread,
Jul 28, 2024, 1:48:56 PM7/28/24
to leo-e...@googlegroups.com
On Sun, Jul 28, 2024 at 11:59 AM Thomas Passin <tbp1...@gmail.com> wrote:
I don't think that restarting Leo is always called for.  A user might change the layout only for certain outlines.  I do that all the time. If there has to be a restart process, then if the default layout is in the settings for a specific outline, then only that outline needs to be restarted.

Interesting idea.  I'll consider it.

Edward

Edward K. Ream

unread,
Jul 28, 2024, 1:52:43 PM7/28/24
to leo-e...@googlegroups.com
@button nodes can easily change layouts! Here are two tested examples:

This kind of button script can only select an "official" layout, including layouts created by plugins.

The concept of layout-defining plugins is still unproven, but I expect success.

Edward

Thomas Passin

unread,
Jul 28, 2024, 2:07:51 PM7/28/24
to leo-editor
The line between core code and plugin code has gotten somewhat blurred.  For example, the qt- plugins or quicksearch.  And I think that's fine.

Edward K. Ream

unread,
Jul 28, 2024, 2:13:37 PM7/28/24
to leo-e...@googlegroups.com
On Sun, Jul 28, 2024 at 1:07 PM Thomas Passin <tbp1...@gmail.com> wrote:
The line between core code and plugin code has gotten somewhat blurred.  For example, the qt- plugins or quicksearch.  And I think that's fine.

I agree. But we expect plugins to define all "local" layouts, so the line isn't too blurred in this situation.

On the onother topic, I think that reloading only an outline will "just work". You've discovered a sweet spot. Our productive collaboration continues!

Edward

Thomas Passin

unread,
Jul 28, 2024, 2:41:43 PM7/28/24
to leo-editor
If it's going to be a complete reload of an outline, it will need to be the whole shebang - save outline if dirty, save selected node and any other configuration items which will need to be saved to the database before reload, just as if a user had decided to reload..

Edward K. Ream

unread,
Jul 28, 2024, 2:49:32 PM7/28/24
to leo-e...@googlegroups.com
On Sun, Jul 28, 2024 at 1:41 PM Thomas Passin <tbp1...@gmail.com> wrote:
If it's going to be a complete reload of an outline, it will need to be the whole shebang - save outline if dirty, save selected node and any other configuration items which will need to be saved to the database before reload, just as if a user had decided to reload..

Exactly.

Edward
Reply all
Reply to author
Forward
0 new messages