This is all looking good.  The command *gui.find_widget_by_name *is 
especially valuable.  Without it one has to spend a lot of annoying time 
fishing around through parent and child widgets to find the one you want.  
You also need a way to find the name of the widget you want, which could be 
hard to find. The new *show-qt-widgets*  helps a lot here. I think there 
may be room for another way to show the names, but for now this command 
does the job.

I already have my script to toggle VR3 over the body editor working with 
both the new and old layouts.

On Monday, May 20, 2024 at 7:53:39 AM UTC-4 Edward K. Ream wrote:

> 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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/eb07d269-4f16-4ec4-8b01-9d3bca6cc023n%40googlegroups.com.

Reply via email to