After upgrade to 6.8.3: How can I rearrange Leo's window panes

69 views
Skip to first unread message

p.os...@datec.at

unread,
Dec 15, 2024, 12:35:27 PM12/15/24
to leo-editor
My window layout used to be:
Main split vertical.
Left hand side pane: Outline pane going from top to bottom.
Rite hand side: Body pane on top, logging etc. pane below (so a horizontal split devides the rite hand side window).

No, after upgrading to 6.8.3 the split is horz:
Bottom, reaching from left to rite: Body pane.
Top, split by a vert split: Left hand side: Outline pane; rite hand side: Log etc. pane.

How can I change this back to the layout I'm used to for ages now? I couldn't find any setting for this.

Cheers
Paul

P.S.:
Old and desired layout:
outline  |  body
outline  |  --------
outline  |  log

New and undesired layout:
outline   |     log
-----------------------
outline outline

Thomas Passin

unread,
Dec 15, 2024, 1:04:42 PM12/15/24
to leo-editor
We don't have a standard layout line that at present.  The new layout system makes it very easy to create new layouts like yours.  Here's a layout command that will create your layout.  You can put it into an @command node in myLeosettings.leo. Then make it the default layout by adding a settings node @string qt-layout-name = your-special-layout. Use the actual name for your layout command instead of 'your-special-layout'.

Maybe I should write a tutorial on creating new layouts...

from leo.core.leoQt import Orientation

VRX_PLACEHOLDER_NAME = 'viewrenderedx_pane'
LAYOUT = {
    'SPLITTERS': dict(
            (('outlineFrame', 'main_splitter'),
            ('bodyFrame', 'secondary_splitter'),
            ('logFrame', 'secondary_splitter'),
            ('secondary_splitter', 'main_splitter'),
            (VRX_PLACEHOLDER_NAME, 'main_splitter')
            )
        ),
    'ORIENTATIONS': {
        'secondary_splitter': Orientation.Vertical,
        'main_splitter': Orientation.Horizontal
    }
}

dw = c.frame.top
cache = dw.layout_cache
cache.restoreFromLayout(LAYOUT)

p.os...@datec.at

unread,
Dec 15, 2024, 3:01:11 PM12/15/24
to leo-editor
Doesn't work somehow. Here is what I did:

In MyLeoSetting.leo:

- Created a node @settings/Common @command nodes/@command windowlayout-mine
- Copied your code into the node's body.
- In @settings/Qt Gui Misc settings added the node @string qt-layout-name = windowlayout-mine

What have I forgotten?

Thomas Passin

unread,
Dec 15, 2024, 4:34:59 PM12/15/24
to leo-editor
You do need to restart Leo. If you did that (I imagine you did), I'm not sure.  I don't think the @string qt-layout-name node needs to be an immediate child of @settings.

All the built-in layouts have names that begin with "layout-", like "layout-vertical-thirds".  The prefix isn't required in the setting since the code supplies it if it's not present.

Your new command should be available through the minibuffer.  Try it out there.  It should work regardless of the name.  When I tested the code I posted, I did start its name with "layout-". So add that as a prefix to your command's name try that and see if it will apply automatically after a reboot.  If not, I could revisit the code to make sure that part is working as intended.

If your layout command is not present in the minibuffer, then make sure its @command node is a child of an "@commands" node.  I don't remember if that's needed for Leo to add it to the collection of commands, but that's how I've been doing mine. IOW, you want a node structure like

@settings
    @commands
        [Optional organizer nodes]
            @command windowlayout-mine

BTW, I recommend starting your layout's name with "layout-" even if it isn't necessary.  It will make it easier to find via mini-buffer tab completion after you have forgotten its name.

Thomas Passin

unread,
Dec 16, 2024, 12:20:37 AM12/16/24
to leo-editor
I did some testing, and it seems that the layout command names do have to start with "layout-". The prefix doesn't have to be included in the @string qt-layout-name settings node. I don't know if my memory was faulty or if the code was intended to adapt to a lack of the "layout-" prefix but it doesn't.  I'll take a look soon.  Anyway, just prefix your layout command name with "layout-" and all should be well.

The prefix is only needed by the code that applies the default layout. You could add a new layout command to a custom menu and it would not have to start with the prefix.

p.os...@datec.at

unread,
Dec 16, 2024, 2:27:52 AM12/16/24
to leo-editor
That did it! And I had to place it under @commands. Have my Leo back again, thanks a lot!
Reply all
Reply to author
Forward
0 new messages