In  Engineering Notebook: A Script-based Approach To Leo's Layouts 
<https://groups.google.com/g/leo-editor/c/EYQ4odwLLxY> I proposed a system 
to apply layouts (different arrangements of Leo's panes). Attached to this 
post is a Leo outline that contains commands and a menu that let you try 
out the system for yourself.

The outline contains an @settings tree that creates the menu, and the 
commands that it calls.  They include some but not all of the layout 
commands I use myself.  One of the commands establishes a layout that 
Edward has names "big-tree".  These layout commands can be used as guidance 
for creating your own if you like.

There two menu items that create a new widget in a "Tabbed Body". You need 
to create a tabbed body first using the "Make Body Tabbed" menu item 
first.  Otherwise these widgets will open in another location, not in the 
tabbed body.

All layouts may be undone and the default layout re-applied Using the 
"Restore Default Layout" menu item.

The command to create specific layouts in the demo create the layouts with 
specific programs.  But the default layout is applied by a command that 
sets up the default layout by using descriptor data structures.  These 
include which splitters contain which widgets in which order, what 
orientations to apply to which splitters, etc.  These descriptors are 
stored a persistent object, a QWidget that lives in the main splitter.

The outline also contains an *About This Outline* node.

It would be very feasible to adapt the restoration code to run it on a set 
of descriptors from another source, such as a layout creation script.  Then 
it would produce some other layout instead.  This would be easier than 
writing bespoke creation code for each new layout. A layout script would 
look something like this in pseudo-code:

Initialize system if not already initialized.
Create any special objects and splitters needed for the layout.
Read descriptors from layout descriptor file.
Run generic layout code using the special objects and descriptors.

Give the outline a try.  If you find any bugs or unexpected behavior, 
please let me know.  This version has a bug that once you restore the 
default layout, then the VR/VR3 F11 Help display doesn't appear.  I'll 
track down what's happening and correct it. And if you like it, you can 
move the commands and menus over to your myLeoSettings.leo outline and have 
them available to all outlines.

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/a968c2b2-6c9e-457b-93cc-b550751bb711n%40googlegroups.com.

<<attachment: layout_script_commands.zip>>

Reply via email to