Try A Tabbed Body Pane

45 views
Skip to first unread message

Thomas Passin

unread,
Aug 26, 2024, 11:53:05 AM8/26/24
to leo-editor
In the recent discussion about problems with the Add-Editor command and its added editor, I floated the idea of making the body pane be a tabbed widget instead of the current stacked widget.  I found it was simple to make this change in Leo's core code. Trying it out, I wrote a script to put VR3 into the tabbed body pane.  I learned that I like to use it that way.

Then I realized that I could write script so that anyone could try out a tabbed body pane without needing to make any changes in Leo's code. My scripts are in the attached outline. There are three: one to make the change, one to add a VR3 tab, and one to add a VR tab.  You have to run the first one first: Convert Body Editor parent from QStackedWidget to QTabWidget on the fly. This changes the body pane into a tabbed widget. The tabs are draggable so you can change their order.

I don't have scripts to reverse these changes but they would be easy to write.
leo-tabbed-body-scripts.leo

Edward K. Ream

unread,
Aug 26, 2024, 2:50:15 PM8/26/24
to leo-e...@googlegroups.com
On Mon, Aug 26, 2024 at 10:53 AM Thomas Passin <tbp1...@gmail.com> wrote:
In the recent discussion about problems with the Add-Editor command and its added editor, I floated the idea of making the body pane be a tabbed widget instead of the current stacked widget.  I found it was simple to make this change in Leo's core code. Trying it out, I wrote a script to put VR3 into the tabbed body pane.  I learned that I like to use it that way.

Then I realized that I could write script so that anyone could try out a tabbed body pane without needing to make any changes in Leo's code. My scripts are in the attached outline.

This is beautiful work, Thomas. It opens up a range of possibilities.

Edward

Thomas Passin

unread,
Aug 26, 2024, 5:21:40 PM8/26/24
to leo-editor
Thanks, Edward!

I have put these scripts into myLeoSettings.leo as menu items in one of my custom menus.

I can put RPCalc into a tab too, but when it's there it receives both key presses and key releases for some reason and that doubles each number keyed in. After I filter the key releases out RPCalc will go into a body pane tab too.

I first got the idea for making real changes to Leo's behavior using local scripts when I developed the code to highlight the current line in the editor.  I did most of that work, and the development of the right margin marker line code, using scripts in my Workbook.  It's surprising how much can be done that way.

Thomas Passin

unread,
Aug 26, 2024, 11:39:31 PM8/26/24
to leo-editor
It took me only a few minutes to write a script to open my browser bookmarks manager in a tab in the body pane. This app is a custom QWidget that interacts with the tree.  Up to now I have usually put it onto a tab in the log frame, but this is better.  See the attached screen shot.

Basically, any QWidget-based GUI object can be put into a tab in the body pane, once the body pane has been set up with tabs.  It's easy.

bookmark-manger-in-tabbed-body.png
Reply all
Reply to author
Forward
0 new messages