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.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
This is all looking good. The command gui.find_widget_by_name is especially valuable.
I already have my script to toggle VR3 over the body editor working with both the new and old layouts.
Imo, there is no way to have the free_layout and nested_splitter plugins coexist with the PR. I am considering moving those two plugins to the attic.
Imo, there is no way to have the free_layout and nested_splitter plugins coexist with the PR. I am considering moving those two plugins to the attic.I wouldn't go that far. My script tries to use the free_layout method to find the right widget to insert VR3 into, and that raises an exception it uses the new method instead. One could easily move the script into the plugin itself as a command. So I think they could coexist - with some rewriting, of course.
On Mon, May 20, 2024 at 10:20 AM Thomas Passin <tbp1...@gmail.com> wrote:Imo, there is no way to have the free_layout and nested_splitter plugins coexist with the PR. I am considering moving those two plugins to the attic.I wouldn't go that far. My script tries to use the free_layout method to find the right widget to insert VR3 into, and that raises an exception it uses the new method instead. One could easily move the script into the plugin itself as a command. So I think they could coexist - with some rewriting, of course.I'm willing to leave the two plugins where they are, untouched.However, I don't think you (or anyone else) will be able to use them reliably. In the PR, dw.createMainLayout creates the main and secondary splitters as QSplitters, not NestedSplitters. This change is essential. Otherwise the free_layout plugin is privileged, that is, baked into Leo.
On Mon, May 20, 2024 at 10:13 PM Thomas Passin <tbp1...@gmail.com> wrote:Is your experimental version of VR3 using the free_layout command?
Are you good with me merging the PR today?
Is your experimental version of VR3 using the free_layout command?Not any more.
Are you good with me merging the PR today?If you mean merging my private branch (PR #3924) with your ekr-3910-no-fl-ns-plugins branch, please go ahead right away.
How about if we take a little survey in this group and ask who is using which GUI plugins? That might give us some guidance before the change to the new way.
Are you good with me merging the PR today?
If you mean merging my private branch (PR #3924) with your ekr-3910-no-fl-ns-plugins branch, please go ahead right away.Done.Before and after the merge, the `vr3` command works as I expect, but it also causes a weird interaction with Windows 11. I get a message saying "Press Alt-Z to use GeForce experience"!! I have no idea what is going on.Thomas, please test the ekr-3910-no-fl-ns-plugins branch and report if you notice anything unusual with the `vr3` command. Thanks.
VR3 is working with ekr-3910-no-fl-ns-plugins, possible quirks aside. Will check soon on Linux. Freewin is working. RPCalc is still working.
VR3 is working with ekr-3910-no-fl-ns-plugins, possible quirks aside. Will check soon on Linux. Freewin is working. RPCalc is still working.
Did you by any chance bind the vr3 command to a key shortcut? W11 might be using that shortcut itself by default.
The new layout in-body does put VR3 in a new panel next to the body editor. But that whole frame is squashed all the way over to the right so it's not visible. You have to notice the splitter separator and drag it to pull the body.VR3 frame into visibility.
VR3 is working with ekr-3910-no-fl-ns-plugins, possible quirks aside. Will check soon on Linux. Freewin is working. RPCalc is still working.