PR #3911 <https://github.com/leo-editor/leo-editor/pull/3911> eliminates
the free_layout and nested splitter plugins. This work has reached a
milestone.
A single method, *LeoQtGui.find_widget_by_name*, replaces both plugins!
The node *g.command('vr')* shows the *new world order*. See the PR. This
node adds the VR pane to either the body pane or the secondary splitter,
depending on the setting *@string initial-split-orientation*.
Yes, this new code is longer and more complex. Faux helpers typically make
the code *look* simpler. But the new code is *much* better. The new code:
- can do anything that Qt can do.
- does not use the cache.
- is platform-independent.
- is a model for @button nodes and plugins.
- is more specific and explicit.
The old code obscured a design choice. Should the VR pane *always* share
the body pane? I think not. When using the horizontal orientation, the VR
pane should appear on the left side of the screen. In other words, the
secondary splitter should contain the VR pane.
Similar code could insert any Qt widget anywhere, say a QStackedLayout
widget. There is nothing special about QSplitters!
*Conversion and documentation*
How did I know where the body frame was? Leo's new *show-qt-widgets* command
showed me the hierarchy of widgets.
I also studied the way-too-complex code in *ns.add_adjacent*. I *don't* expect
others to redo my study. Documenting the new world order is essential. A
new info item will contain tips and examples.
The VR3 plugin can follow this general pattern. A new setting, say *@string
vr3-initial-layout*, could contain two (*or more!*) strings that tell
*g.command('vr3')* which layout to use. Nothing could be more
straightforward. Notice: VR3 never executes a user script. The setting just
selects
one of several *static* alternatives.
*Summary*
One new method, *LeoQtGui.find_widget_by_name*, can replace the free_layout
and nested_splitter plugins! These plugins are faux helpers. They *limit *what
users can do.
The PR demonstrates how the VR3 plugin could support arbitrarily many
layouts. Just add a new setting. Each outline can choose whatever layout it
wants!
Documenting the new world order is essential. A new info item will contain
tips and examples.
More work is coming. Stay tuned.
All your comments and questions are welcome.
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 on the web visit
https://groups.google.com/d/msgid/leo-editor/c896d7fc-a7e5-4b5c-8f2b-26dec1e4fb84n%40googlegroups.com.