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:

> 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?
> On Sunday, April 9, 2023 at 12:28:45 AM UTC+10 [email protected] wrote:
>
>> Yes, as long as you know its name, which you do from its label:
>>
>>     log.deleteTab(TABNAME)
>>
>> On Saturday, April 8, 2023 at 10:26:30 AM UTC-4 jkn wrote:
>>
>>> 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
>>>
>>> On Friday, April 7, 2023 at 3:04:48 PM UTC+1 [email protected] wrote:
>>>
>>>> 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.
>>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/212faf89-7a66-4670-8db8-7b79ab7475d8n%40googlegroups.com.

Reply via email to