Yes, I get that too. It's because the current layouts have a slot for VRx, and if VR3 is available it goes into the slot, otherwise VR goes in. We discussed how to cure that in an earlier thread (it's not hard) but
AFAIK
nothing has been decided about making a change to the "official" layouts yet.
Never fear, here's a script that will display VR alongside that slot in the layouts:
@language python
"""Toggle VR in main splitter without destroying the instance."""
from leo.core.leoQt import QtCore
def find_widget(name):
return g.app.gui.find_widget_by_name(c, name)
def show_pane(w):
w.setUpdatesEnabled(True)
c.doCommandByName('vr-show')
c.doCommandByName('layout-initialize')
cache = find_widget('leo-layout-cache')
# Find or create VR widget
vr = find_widget('viewrendered_pane')
if not vr:
import leo.plugins.viewrendered as v
vr = v.getVr()
ms = find_widget('main_splitter')
if vr.parent() == ms:
vr.setParent(cache)
else:
ms.addWidget(vr)
g.app.gui.equalize_splitter(ms)
# Avoid flash each time VR pane is re-opened.
QtCore.QTimer.singleShot(60, lambda: show_pane(vr))
If because of your layout you would rather have VR appear next to the secondary splitter, just change `main_splitter` to 'secondary_splitter'. I have
a custom menu item
to launch this command .
This command makes use of another custom command named "layout-initialize". You can comment out this line but the VR pane will be better-behaved if you include it. IIRC, I wrote this command before the layout system was finalized and it could probably be improved on.
Some of the dictionary keys don't even exist anymore so they get defaulted.
But it does the job for me. Here's the command, which you should add as an @command
layout-initialize
node to myLeoSettings.leo:
@language python
"""Initialize layout widget cache and dicts."""
from collections import OrderedDict
from leo.core.leoQt import QtWidgets, Orientation
CACHENAME = 'leo-layout-cache'
CACHEHOME = c.frame.top
cache = g.app.gui.find_widget_by_name(c, CACHENAME)
if not cache:
cache = QtWidgets.QWidget(CACHEHOME)
cache.hide()
cache.setObjectName(CACHENAME)
ESSENTIALS = 'layout-essential-objects'
if not c.user_dict.get(ESSENTIALS):
SPLITTERS = OrderedDict(
(('outlineFrame', 'secondary_splitter'),
('logFrame', 'secondary_splitter'),
('secondary_splitter', 'main_splitter'),
('bodyFrame', 'main_splitter'))
)
c.user_dict[ESSENTIALS] = SPLITTERS
DEFAULT_ORIENTATIONS = 'layout-default-orientations'
if not c.user_dict.get(DEFAULT_ORIENTATIONS):
ORIENTATIONS = {
'main_splitter':Orientation.Horizontal,
'secondary_splitter':Orientation.Vertical}
c.user_dict[DEFAULT_ORIENTATIONS] = ORIENTATIONS
If these scripts don't quite work for you, let me know and we'll come up with a custom layout for you that can contain both VR and VR3.
BTW, did you know you can enable a different set of plugins for individual outlines? I didn't until a few days ago. You can copy the @enabled-plugins node to the @settings tree in an outline and change it, e.g., by commenting out VR3. Only that outline will get the changes. The others will continue to get the plugins enabled in myLeoSettings.leo.