VR3 can now be opened in a tab

74 views
Skip to first unread message

Thomas Passin

unread,
Apr 7, 2023, 10:04:48 AM4/7/23
to leo-editor
The VR3 plugin can now optionally open in a tab in the log pane instead of in its own panel in the main Leo window (also referred to as a pane in the splitter).  I have attached a screen shot that shows the panel layout that I like when using VR3 in a tab.

There are two new commands to control that tab behavior:

vr3-tab -- opens VR3 in a tab
vr3-toggle-tab -- opens or closes VR3 in a tab.

I like to use an @button node in the @settings tree to make a button for vr3-toggle-tab. The button runs c.k.simulateCommand('vr3-toggle-tab').

vr3-toggle will close VR3 if open in a splitter pane as well as in a tab.  Next time, the command will open it in the splitter.  Conversely, vr3-toggle-tab will close VR3 in either a tab or the splitter, but will re-open it in a tab the next time the command is run.

An advantage to running VR3 in a tab is that you can open something else in a new splitter pane without interfering with VR3.

One minor drawback is that focus will switch to the log pane when something is written there - most likely when the outline has been saved.  Then you have to click in the VR3 tab to see it again.  I haven't found this to bother me much.

This new behavior has now been merged into the devel branch, so it's ready to try out.
vr3-tab-screenshot.png

jkn

unread,
Apr 8, 2023, 10:26:30 AM4/8/23
to leo-editor
This look interesting, thanks.

One thing I have never really needed, but occasionally wondered about; it is possible to *delete* a tab in the log pane? (perhaps it should be called the 'tab pane'?...)

    J^n

Thomas Passin

unread,
Apr 8, 2023, 10:28:45 AM4/8/23
to leo-editor
Yes, as long as you know its name, which you do from its label:

    log.deleteTab(TABNAME)

jkn

unread,
Apr 8, 2023, 10:44:09 AM4/8/23
to leo-editor
I meant at the user level - right-click on a tab or similar... I occasionally have tabs 'outstay their welcome' (as in, I don't need their content any more)

Thomas Passin

unread,
Apr 8, 2023, 12:19:44 PM4/8/23
to leo-editor
I've been thinking they could be given a close box.  I've not looked in to what it would take, though.

lewis

unread,
Apr 9, 2023, 7:22:19 AM4/9/23
to leo-editor
I use an @button Delete-TAB

    TAB_name = g.app.gui.runAskOkCancelStringDialog(c,'Delete TAB',"Enter Tab name: ").strip()
    c.frame.log.deleteTab(TAB_name)  # delete named Tab

Is there a way to get a list of Tab names?

Thomas Passin

unread,
Apr 9, 2023, 8:50:50 AM4/9/23
to leo-editor
Yes:

log = c.frame.log
g.es(log.orderedTabNames())

BTW, here's how I found this.  I certainly didn't remember, and you may have a better way.  Start with the script for your button. It calls a method log.deleteTab.  In Leo's core code, similar methods are generally grouped together under the same parent node.  So I used the Nav tab - my favorite for searches - and typed in "deleteTab".  It returned two headlines that matched, one of which was "LeoLog.deleteTab".  I clicked on that entry and was navigated to that part of the code.  Then I just scanned the other names until I noticed "LeoLog.orderedTabNames".  That was it.

I usually find this to be the most effective way to proceed.  Sometimes you don't get a hit on a method or class definition but you find a place that it is called.  You can CTRL-click on its name in the code and Leo will (usually) succeed at navigating you to its def: or class: definition.

Now that I've gotten used to working this way, I don't know how I could stand going back to non-Leo ways of managing of code bases.

Thomas Passin

unread,
Apr 17, 2023, 11:09:53 PM4/17/23
to leo-editor
Here is an alternative way to delete a tab, where you type the tab name into the minibuffer.  The code can go into an @command or @button node:

"""Delete named tab from log frame. Get tab name to delete from minbuffer."""
def delete_tab():
    """State 0"""
    k = c.k
    k.setLabelBlue('prompt: ')
    event = {}
    k.get1Arg(event, handler = delete_tab1)

def delete_tab1(event):
    """State 1"""
    k = c.k
    # ----> k.arg contains the argument.
    tabname = k.arg
    log = c.frame.log
    log.deleteTab(tabname)
    # Reset the minibuffer.
    k.clearState()
    k.resetLabel()
    k.showStateAndMode()

delete_tab()




On Sunday, April 9, 2023 at 7:22:19 AM UTC-4 lewis wrote:

jkn

unread,
Apr 18, 2023, 3:28:03 AM4/18/23
to leo-editor

To be fair, many/most modern editors have some sort of 'find definition' and 'find references' feature

Edward K. Ream

unread,
Apr 18, 2023, 6:16:39 AM4/18/23
to leo-e...@googlegroups.com
On Tue, Apr 18, 2023 at 2:28 AM jkn <jkn...@nicorp.f9.co.uk> wrote:

To be fair, many/most modern editors have some sort of 'find definition' and 'find references' feature

But only cff gives you the ability to organize the results.

Edward
Reply all
Reply to author
Forward
0 new messages