On Sat, Jul 20, 2024 at 9:36 AM Jacob Peck wrote:
> can't you [do something general :-)]
I usually approach tricky tasks by writing specific code first.
Here is a prototype undoer for the "quadrants" layout. It's in a separate
node for prototyping:
h = c.hash()
pc = g.app.pluginsController
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
--
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/CAMF8tS1Hj7MU4nvZx49ZhOKXJm_adowjVcFgE1OAN3RJjSiqCQ%40mail.gmail.com.