Great!  Will test it soon.

Meanwhile, here's an improvement on my script for "render-focused".  The 
cognitive dissonance is gone, unnecessary or redundant code is gone, and it 
works with VR even if VR is already open in some other layout.

"""Change layout to Gates # 3 "render-focused"."""
# ref: 
https://gist.github.com/gatesphere/82c9f67ca7b65d09e85208e0b2f7eca1#file-render-focused

from leo.core.leoQt import Orientation
import leo.plugins.viewrendered3 as vx
cmd = 'vr3-show' if 'ed3' in vx.__name__ else 'vr-toggle'

gui = g.app.gui

ms = gui.find_widget_by_name(c, 'main_splitter')
ss = gui.find_widget_by_name(c, 'secondary_splitter')
lf = gui.find_widget_by_name(c, 'logFrame')
edf = gui.find_widget_by_name(c, 'bodyFrame')

init_orientation = ms.orientation()
if init_orientation != Orientation.Horizontal:
    ms.setOrientation(Orientation.Horizontal)
ss.setOrientation(Orientation.Vertical)

ms.addWidget(lf)  # Temporarily to get body to be second
ss.addWidget(edf)
ss.addWidget(lf)

h = c.hash()
vrx = vx.controllers.get(h)

if not vrx:
    vx.controllers[h] = vrx = vx.ViewRenderedController3(c)

ms.addWidget(vrx)
if vrx.isHidden():
    c.doCommandByName(cmd)

ss.setSizes([100_000] * len(ss.sizes()))
ms.setSizes([100_000] * len(ms.sizes()))

On Thursday, July 18, 2024 at 9:50:15 PM UTC-4 [email protected] wrote:

> Here's my go at a `quadrants` layout:
>
> ```
> from leo.core.leoQt import Orientation, QtWidgets
> import leo.plugins.viewrendered as vr
>
> gui = g.app.gui
>
> def make_splitter():
>   w = QtWidgets.QSplitter()
>   w.setObjectName('body_splitter')
>   return w
>
>
> ms = gui.find_widget_by_name(c, 'main_splitter')
> ss = gui.find_widget_by_name(c, 'secondary_splitter')
> edf = gui.find_widget_by_name(c, 'bodyFrame')
>
> # add vertical splitter to ms (hosting only the editor)
> body_splitter = make_splitter()
> body_splitter.setOrientation(Orientation.Vertical)
> ms.addWidget(body_splitter)
> body_splitter.addWidget(edf)
>
> # add vr pane
> h = c.hash()
> vrp = vr.controllers.get(h)
>
> if not vrp:
>     vr.controllers[h] = vrp = vr.ViewRenderedController(c)
>
> if not vrp.isVisible():
>     body_splitter.addWidget(vrp)
>     body_splitter.setSizes([100_000] * len(body_splitter.sizes()))
>     ms.setSizes([100_000] * len(ms.sizes()))
>     ss.setSizes([100_000] * len(ss.sizes()))
>     c.doCommandByName('vr-show')
> ```
>
> I wasn't sure exactly which invocations of setSizes I needed, so I just 
> did all of them to perfectly balance everything.  Thanks for the 
> boilerplate of the script, Thomas -- supremely useful in combination with 
> Edward's info item #3982.
>
> Jake
>
> On Thu, Jul 18, 2024 at 9:45 PM Thomas Passin <[email protected]> wrote:
>
>>
>> On Thursday, July 18, 2024 at 9:11:29 PM UTC-4 Edward K. Ream wrote:
>>
>> On Thu, Jul 18, 2024 at 4:27 PM Thomas Passin <[email protected]> wrote:
>>
>> And here's a script to create Jacob's Layout #3 "render-focused".  This 
>> script will work for either VR or VR3 if you just change the module 
>> imported at the top.
>>
>>
>> Thanks for this. The script works for me with VR3 but not VR. I'll post a 
>> revised script asap.
>>
>>
>> It worked for both for me. If the pane on the right shows up but VR isn't 
>> showing anything, try running the "vr-show'" command.  I went to the toggle 
>> command when vr-show didn't work, but maybe you had VR visible already and 
>> the toggle turned it off.
>>
>> The intended import change is from 
>>
>> import leo.plugins.viewrendered3 as v3
>>
>> to
>>
>> import leo.plugins.viewrendered as v3
>>
>> The naming as "v3" and "vr3" when the desired widget is VR is a bit of 
>> cognitive dissonance.  It was simpler that way for a quick proof of 
>> principle.
>>
>> -- 
>>
> 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/a40175bf-e694-4491-bf07-34dcebf549a0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/leo-editor/a40175bf-e694-4491-bf07-34dcebf549a0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/76fe7c81-d18e-4807-813c-b9708f0ecfa7n%40googlegroups.com.

Reply via email to