Progress Report On The Script-Based Layouts Work

91 views
Skip to first unread message

Thomas Passin

unread,
Sep 5, 2024, 1:48:30 PM9/5/24
to leo-editor
I want to post an update on the layout work.  In  An Outline To Demonstrate The Script-based Layout System I provided a Leo outline that contained all the scripts needed for demonstrating how they can change Leo's pane arrangements ("layouts").  Since then I have been able to simplify the scripts, removed a few pesky bugs, added a new layout, and made sure the scripts run on Linux systems (which they mostly did before).

The new layout is the "Quadrant" layout originally devised by Jacob.  It is a good test of the system because it inserts an additional splitter into the layout. The code for restoring the layout to the original default one is able to handle this added splitter without trouble.

For anyone who is following the technical aspects, I moved the permanent widget cache from the main splitter to c.frame.top.  We want the location to be a permanently available widget derived from a QWidget, and this move gets the cache out of the very widget that is getting modified (so I could remove some special cases). I revised the restore code to take advantage of certain methods that QSplitters have that generic QWidgets do not.  This allowed me to simplify the code and remove some bugs.  It also speeded up the restore script. I was also able to simplify the initialization script.

Finally, there had been a problem with layouts that used the viewrendered plugin. About a month ago a breaking change was made to its interface that changed how it is instantiated.  I added code that falls back to the old way so that people who haven't updated Leo for more than a month can still use these layouts.

Because of this change, trying to get help for Leo commands using F11 - or using the equivalent minibuffer command - may seem not to work.  They do work but you will have to make VR/VR3 visible first. I don't plan to try to fix this because it would involve recent code in Leo's core that makes assumptions about what display elements will be available.  I don't want to make any changes there until we have pretty well settled what the layout system will be like.

To try out the new version of the outline, unzip it, open it in Leo, and play with the "Layout Demo" menu that it adds to the menu bar (only for that outline - you can copy the commands and the menu over to myLeoSettings.leo if you want them to be available for all outlines).
Layout-Demo.zip

Viktor Ransmayr

unread,
Sep 5, 2024, 2:59:06 PM9/5/24
to leo-editor
Hello Thomas

tbp1...@gmail.com schrieb am Donnerstag, 5. September 2024 um 19:48:30 UTC+2:
I want to post an update on the layout work.  In  An Outline To Demonstrate The Script-based Layout System I provided a Leo outline that contained all the scripts needed for demonstrating how they can change Leo's pane arrangements ("layouts"). 
...
To try out the new version of the outline, unzip it, open it in Leo, and play with the "Layout Demo" menu that it adds to the menu bar ...

As I mentioned in the other thread I'll do some ~ thorough ~ work tomorrow !

However I was just interested & tried out the ~ new ~ command, i.e.  'Quadrant Layout' ...

It succeeds - AND - delivers the following output:

###

Path override failed for key base::DIR_APP_DICTIONARIES and path '/usr/bin/qtwebengine_dictionaries'
Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.12/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.12/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
[7281:8:0905/204136.946520:ERROR:command_buffer_proxy_impl.cc(127)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

###

Let me know if you are interested in something specifically in my Fedora 40 VM for that particular command ...

With kind regards,

Viktor

Thomas Passin

unread,
Sep 5, 2024, 3:19:59 PM9/5/24
to leo-editor
Thanks for testing.  I don't know how much can be done about those error messages.  They are Qt things, most likely related to the QWebEngineView that VR3 depends on, and various installs on different OSs and computers sometimes show similar but different messages related to a missing shared library. I forget whether this one has surfaced before.  Sometimes it's a matter of exporting an environmental variable, sometimes it's a matter of finding the right library name and installing it with the OS package manager.  The fix can be different for different OSs, too.

I believe I have seen one like " Failed to send GpuControl.CreateCommandBuffer" before.

Lucky Qt can keep working anyway!  If I find a VM install that produces the messages, perhaps I can help.  And an internet search might get lucky. I disliked Fedora so much that I never opened it but I changed to the Cinnamon desktop manager and it's somewhat better.  My VM is Fedora 3.9.

lewis

unread,
Sep 5, 2024, 4:19:49 PM9/5/24
to leo-editor
See Qt bug 124110 about the  DIR_APP_DICTIONARIES and path '/usr/bin/qtwebengine_dictionaries' messages.

Thomas Passin

unread,
Sep 5, 2024, 4:45:36 PM9/5/24
to leo-editor
Thanks. Seems like we'll have to wait for Qt6.8.

Thomas Passin

unread,
Sep 5, 2024, 5:24:38 PM9/5/24
to leo-editor
On my Fedora 3.9 VM, I see the same error messages, and VR3 works anyway, just as for Lewis.

Viktor Ransmayr

unread,
Sep 6, 2024, 5:01:01 AM9/6/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Donnerstag, 5. September 2024 um 19:48:30 UTC+2:
I want to post an update on the layout work. 
...
To try out the new version of the outline, unzip it, open it in Leo, and play with the "Layout Demo" menu that it adds to the menu bar ...

As promised earlier I did a test of all commands in a Debian 12 VM - Below are the results:

With kind regards,

Viktor

###
 
    Leo Log Window
    Leo 6.8.2-devel, devel branch, build e08c163aeb
    2024-07-27 06:13:35 -0500
    Python 3.11.2, PyQt version 6.7.0
    linux
    reading settings in /home/user/Documents/TBP-Layout-Script-Commands-V3.leo
    read outline in 0.00 seconds

    ### Layout Demo > Make Body Tabbed ---> OK.

    ### Layout Demo > Restore Default Layout ---> OK.

    ### Layout Demo > Swap Nav Frame Location ---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 - Open In Tabbed Body


    Path override failed for key base::DIR_APP_DICTIONARIES and path '/usr/bin/qtwebengine_dictionaries'
    Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
    Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
    If this causes problems, reconfigure your locale. See the locale(1) manual
    for more information.
    Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.11/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
    Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
    Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
    If this causes problems, reconfigure your locale. See the locale(1) manual
    for more information.
    Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.11/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
    [1712:7:0906/103440.733860:ERROR:command_buffer_proxy_impl.cc(127)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 -Toogle In Split Main Panel
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 - Toogle In Log Frame
---> OK.

    ### Layout Demo > VR3 - Toogle In Log Frame
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR - Open In Tabbed Body
---> OK?

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR -Toogle In Split Main Panel
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > RPCalc - Open In Tabbed Body

    VR3 -- no asciidoc processor
    VR3 -- no asciidoc3 processor
    Can't find /home/user/.leo/vr3/vr3_config.ini so VR3 cannot execute non-Python code
    VR3 Markdown stylesheet: file:////home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3/md_styles_solarized_dark.css
    VR3 RsT stylesheet: /home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3/v3_rst_solarized-dark.css
    no command function for 'layout-open-rpcalc-in-tabbed-body'

    no command function for 'layout-open-rpcalc-in-tabbed-body'
    doCommandByName load,runMainLoop,qt_add_command_callback,static_menu_callback

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > Big Tree Layout
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > Qudrant Layout

    Traceback (most recent call last):

      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoCommands.py", line 2760, in doCommand
        return_value = command_func(event)
                       ^^^^^^^^^^^^^^^^^^^

      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3.py", line 1711, in show_rendering_pane
        vr3.show_dock_or_pane()

      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3.py", line 4706, in show_dock_or_pane
        vr3.activate()
        ^^^^^^^^^^^^

    AttributeError: 'tuple' object has no attribute 'activate'

    ### Layout Demo > Restore Default Layout
---> OK.

Viktor Ransmayr

unread,
Sep 6, 2024, 6:07:59 AM9/6/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Donnerstag, 5. September 2024 um 19:48:30 UTC+2:
I want to post an update on the layout work.  ...

To try out the new version of the outline, unzip it, open it in Leo, and play with the "Layout Demo" menu that it adds to the menu bar ...

And here are the test results for all commands in a Fedora 40 VM.

The warnings for the 'Layout Demo > Quadrant Layout' command reported yesterday are gone today - All I did was a DNF update / upgrade check ...

With kind regards,

Viktor

###

    Leo Log Window
    Leo 6.8.2-devel, devel branch, build 12f06b69ea
    2024-08-28 10:58:09 -0500
    Python 3.12.5, PyQt version 6.7.1

    linux
    reading settings in /home/user/Documents/TBP-Layout-Script-Commands-V3.leo
    read outline in 0.00 seconds

    ### Layout Demo > Make Body Tabbed ---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.


    ### Layout Demo > Swap Nav Frame Location
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 - Open In Tabbed Body

    Path override failed for key base::DIR_APP_DICTIONARIES and path '/usr/bin/qtwebengine_dictionaries'
    Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.12/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
    Path override failed for key base::DIR_APP_DICTIONARIES and path '/home/user/PyVE/GitHub/Leo/lib/python3.12/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
    [1886:7:0906/114334.823414:ERROR:command_buffer_proxy_impl.cc(127)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.


    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 -Toggle In Split Main Panel
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR3 - Toggle In Log Frame
---> OK.

    ### Layout Demo > VR3 - Toggle In Log Frame
---> OK.


    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR - Open In Tabbed Body

    getVr "c" or "event" kwarg required atCommandCallback,executeScript,executeScriptHelper,<module>


    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > VR -Toggle In Split Main Panel
---> OK.


    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > RPCalc - Open In Tabbed Body

    Leo Log Window
    Leo 6.8.2-devel, devel branch, build 12f06b69ea
    2024-08-28 10:58:09 -0500
    Python 3.12.5, PyQt version 6.7.1

    linux
    reading settings in /home/user/Documents/TBP-Layout-Script-Commands-V3.leo
    read outline in 0.00 seconds
    VR3 Markdown stylesheet: file:////home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3/md_styles_solarized_dark.css
    VR3 RsT stylesheet: /home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/viewrendered3/v3_rst_solarized-dark.css
    no command function for 'layout-open-rpcalc-in-tabbed-body'

    no command function for 'layout-open-rpcalc-in-tabbed-body'
    doCommandByName load,runMainLoop,qt_add_command_callback,static_menu_callback

    ### Layout Demo > Restore Default Layout
---> OK.


    ### Layout Demo > Big Tree Layout
---> OK.

    ### Layout Demo > Restore Default Layout
---> OK.

    ### Layout Demo > Qudrant Layout
---> OK.

Thomas Passin

unread,
Sep 6, 2024, 7:22:09 AM9/6/24
to leo-editor
Thanks for the reports.  I think that the RPCalc plugin needs to be enabled for that menu item to work. Those "dictionary" messages we're going to have to live with until a new version of PyQt6 comes out but at least they don't indicate any functional problems.

 On Debian, that message "vr3.activate" and the related ones happen for a version of Leo more than about a month old ... except that I thought I had fixed that for the quadrant layout.  I'll look and see if I forgot to do so.

Viktor Ransmayr

unread,
Sep 6, 2024, 7:38:11 AM9/6/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Freitag, 6. September 2024 um 13:22:09 UTC+2:
...
 On Debian, that message "vr3.activate" and the related ones happen for a version of Leo more than about a month old ... except that I thought I had fixed that for the quadrant layout.  I'll look and see if I forgot to do so.

You were right. !- My 'devel' branch was not fully up to date. - I updated it & the warnings are gone in the Debian VM as well !

With kind regards,

Viktor
 

Viktor Ransmayr

unread,
Sep 6, 2024, 7:46:29 AM9/6/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Freitag, 6. September 2024 um 13:22:09 UTC+2:
Thanks for the reports.  I think that the RPCalc plugin needs to be enabled for that menu item to work.

This would be only the case in my Debian VM, were I only have VR active ...

But it's not the case for my Fedora VM, were VR3 is active since quite some time - and - you see the same problem !

Just for the record, here's Leo's log from the Fedora VM.

With kind regards,

Viktor

###
 
Leo Log Window
Leo 6.8.2-devel, devel branch, build 12f06b69ea
2024-08-28 10:58:09 -0500
Python 3.12.5, PyQt version 6.7.1
linux
setting leoID from os.getenv('USER'): 'user'
      home: /home/user
leo-editor: /home/user/PyVE/GitHub/Leo/leo-editor
      load: /home/user/PyVE/GitHub/Leo/leo-editor/leo/core
    config: /home/user/PyVE/GitHub/Leo/leo-editor/leo/config
reading settings in /home/user/PyVE/GitHub/Leo/leo-editor/leo/config/leoSettings.leo
reading settings in /home/user/.leo/myLeoSettings.leo
reading settings in /home/user/PyVE/GitHub/Leo/leo-editor/leo/themes/tbp_dark_solarized.leo

VR3 -- no asciidoc processor
VR3 -- no asciidoc3 processor
Can't find /home/user/.leo/vr3/vr3_config.ini so VR3 cannot execute non-Python code
reading settings in /home/user/Documents/SL2024.leo
read outline in 0.25 seconds


Viktor Ransmayr

unread,
Sep 6, 2024, 7:54:41 AM9/6/24
to leo-editor
Hello Thomas,

Viktor Ransmayr schrieb am Freitag, 6. September 2024 um 13:46:29 UTC+2:
Hello Thomas,

tbp1...@gmail.com schrieb am Freitag, 6. September 2024 um 13:22:09 UTC+2:
Thanks for the reports.  I think that the RPCalc plugin needs to be enabled for that menu item to work.

This would be only the case in my Debian VM, were I only have VR active ...

But it's not the case for my Fedora VM, were VR3 is active since quite some time - and - you see the same problem !

Sorry for the noise - I should have really read what you wrote :-(

With kind regards,

Viktor
 

Viktor Ransmayr

unread,
Sep 6, 2024, 8:28:47 AM9/6/24
to leo-editor
Hello Thomas,

Viktor Ransmayr schrieb am Freitag, 6. September 2024 um 13:54:41 UTC+2:
...


tbp1...@gmail.com schrieb am Freitag, 6. September 2024 um 13:22:09 UTC+2:
Thanks for the reports.  I think that the RPCalc plugin needs to be enabled for that menu item to work.

This would be only the case in my Debian VM, were I only have VR active ...

But it's not the case for my Fedora VM, were VR3 is active since quite some time - and - you see the same problem !

Sorry for the noise - I should have really read what you wrote :-(

Now I did read - and - double-check on Debian - as well as - on Fedora :

The problem persists, i.e.  I have the plugin enabled in "mySettings.leo" - but - when I perform 'Layout Demo > RPCalc - Open In Tabbed Body' I STILL receive the error in Debian & Fedora.

    no command function for 'layout-open-rpcalc-in-tabbed-body'

However if I perform 'Plugins > rpcalc > rpcalc-toggle' the plugin GUI appears ...

With kind regards,

Viktor

Thomas Passin

unread,
Sep 6, 2024, 10:18:20 AM9/6/24
to leo-editor
I see what happened about RPCalc.  In my own leoSettings.leo outline, the  layout-open-rpcalc-in-tabbed-body command is under a different mode than all the other layout commands.  To create the Layout Demo outline I copied over the menu and layout commands nodes. So the RPCalc node didn't get included.  I didn't notice it in functional testing because the command is still available in myLeoSettings.leo.

I will fix up these problems and make sure that I've generalized the all VR3 commands to be able to use either the old or new creation methods. I'll post the revised outline here soon. Thanks for helping me to sort out all these things!

Thomas Passin

unread,
Sep 6, 2024, 4:02:12 PM9/6/24
to leo-editor
I have cleaned up and improved the LayoutDemo.leo outline. It works right for me on both Windows and Linux (using both the current devel version of Leo and one from a few months ago (before some changes were made to VR and VR3 construction).

I used both Debian 12 and Fedora 3.9 for Linux testing, and Windows 10 for Windows.  On Linux you are likely to see those warning messages about dictionaries.  They are a Qt issue, don't affect functionality, and supposedly are scheduled to be handled in Qt 6.8.

You may see a few messages from VR3 when it first opens, such as ones saying that there is no markdown or asciidoc.  Those are not errors but if you want to use that part of the functionality you need to pip-install the packages.

Layout-Demo.zip

Viktor Ransmayr

unread,
Sep 7, 2024, 3:47:33 AM9/7/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Freitag, 6. September 2024 um 22:02:12 UTC+2:
I have cleaned up and improved the LayoutDemo.leo outline. It works right for me on both Windows and Linux (using both the current devel version of Leo and one from a few months ago (before some changes were made to VR and VR3 construction).

I used both Debian 12 and Fedora 3.9 for Linux testing, and Windows 10 for Windows.  On Linux you are likely to see those warning messages about dictionaries.  They are a Qt issue, don't affect functionality, and supposedly are scheduled to be handled in Qt 6.8.

Everything is working as described in a Fedora 40 VM on my side as well. - Thanks a lot for this demo update !

With kind regards,

Viktor
 

Thomas Passin

unread,
Sep 7, 2024, 7:14:13 AM9/7/24
to leo-editor
Thank you, Viktor.
Reply all
Reply to author
Forward
0 new messages