Here is a revised version of my script to show the viewrendered3 plugin in 
the same pane as the body editor.  The command toggles between the VR3 
rendered view and the body editor view.  I have it connected to a button on 
the button bar.  You can use it without even enabling the plugin in your 
settings file.

@language python
"""Toggles the body frame between the body editor and
a Viewrendered3 rendered view.
"""
from leo.core.leoQt import QtWidgets
import leo.plugins.viewrendered3 as v3

def toggle_vr3_in_body(c):
    flc = c.free_layout  # free layout controller
    top = flc.get_top_splitter()
    if top:
        bfw = top.find_child(QtWidgets.QWidget, "bodyFrame")
        kids = bfw.children()

    qf0 = kids[0]
    stacked_layout = qf0.children()[0]
    h = c.hash()
    if stacked_layout.count() == 1:
        v3.controllers[h] = vr3 = v3.ViewRenderedController3(c)
        stacked_layout.addWidget(vr3)

    if stacked_layout.currentIndex() == 0:
        # vr3 = v3.controllers[h]
        # stacked_layout.setCurrentWidget(vr3)
        vr3 = stacked_layout.widget(1)
        stacked_layout.setCurrentIndex(1)
        vr3.set_unfreeze()
    else:
        vr3 = stacked_layout.widget(1)
        vr3.set_freeze()
        stacked_layout.setCurrentIndex(0)

toggle_vr3_in_body(c)

-- 
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/5b8886b9-bd10-405c-8ef6-d22af41d648en%40googlegroups.com.

Reply via email to