gui = g.app.gui
vr_splitter = gui.find_widget_by_name(c, 'vr-body-splitter')
vr3_splitter = gui.find_widget_by_name(c, 'vr3-body-splitter')
body_frame = gui.find_widget_by_name(c, 'bodyFrame')
parent = (
vr_splitter.parent() if vr_splitter
else vr3_splitter.parent() if vr3_splitter
else None
)
if vr_splitter:
vr_splitter.deleteLater()
if vr3_splitter:
vr3_splitter.deleteLater()
if parent:
parent.addWidget(body_frame)
parent.setSizes([100_000] * len(parent.sizes()))
Notice that there may be two body splitters, now each with its own separate name.
This works, as far as the gui goes, but deleting the splitters causes repeated crashes both the VR and VR3 plugins:
Traceback (most recent call last):
File "C:\Repos\leo-editor\leo\core\leoPlugins.py", line 348, in callTagHandler
result = handler(tag, keywords)
File "C:\Repos\leo-editor\leo\plugins\viewrendered.py", line 363, in onClose
vr.deleteLater()
RuntimeError: wrapped C/C++ object of type ViewRenderedController has been deleted
Traceback (most recent call last):
File "C:\Repos\leo-editor\leo\core\leoPlugins.py", line 348, in callTagHandler
result = handler(tag, keywords)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\plugins\viewrendered3.py", line 1475, in onClose
vr3.deleteLater()
RuntimeError: wrapped C/C++ object of type ViewRenderedController3 has been deleted
...
These crashes aren't too surprising, but fixing them is another matter :-)
Summary
My usual method is to generalize after I know all the details for a particular task. YMMV.
Edward