It can be done without the import, making the script two lines shorter:

"""Move Nav frame between main and secdary splitters."""
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')

nav_in_secondary = ss.findChild(type(lf), "logFrame")
target = ms if nav_in_secondary else ss
target.addWidget(lf)

# Equalize sizes - "100000" must be larger than any of the widgets...
# and well less than MAX_INT
target.setSizes([100_000] * len(target.sizes()))


On Sunday, May 26, 2024 at 6:54:49 PM UTC-4 Thomas Passin wrote:

> In practice, this means changing which panel the Nav frame shares:
> 1. Next (usually to the right) to the body editor; or
> 2. Next (usually below) the tree.
>
> With the old nested splitter layout Leo had for so long, it was possible 
> to get this arrangement using the context menu of the splitter bar, but it 
> wasn't very obvious how.
>
> With the new layout code and the retirement of the nested splitter and the 
> splitter bar menu, can this be done? Yes, here is a script.  It could be 
> used as a model for moving other frames.  Each time it is run, the Nav 
> frame trades places.
>
> """Move Nav frame between main and secondary splitters."""
> from leo.core.leoQt import QtWidgets
> QFrame = QtWidgets.QFrame
>
> 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')
>
> nav_in_secondary = ss.findChild(QFrame, "logFrame")
> target = ms if nav_in_secondary else ss
> target.addWidget(lf)
>
> # Equalize sizes - "100000" must be larger than any of the widgets...
> # and well less than MAX_INT
> target.setSizes([100_000] * len(target.sizes()))
>

-- 
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/29238529-78bb-4b10-b57b-84220be08c1dn%40googlegroups.com.

Reply via email to