PR
#4017 has passed an important milestone. It contains working
layout-creation methods for Leo's legacy and "big-tree" layouts.
See the first comment of the PR for an overview of the changes.
Important: the PR will restart Leo if the user executes the reload-settings command after changing the @string qt-layout-name setting. This scheme sidesteps the difficult (intractable?) problem of undoing Qt layouts.
Suppose that a Leonista wants to use multiple layouts in an outline. This happens when developing layouts. It would be clumsy to change the
qt-layout-name setting. Happily, @button nodes can easily change layouts! Here are two tested examples:
@button legacy
h = '@string qt-layout-name'
layout = 'legacy'
p = g.findNodeAnywhere(c, h, exact=False)
if p and p.h.endswith(f" {layout}"):
g.es_print('no change')
else:
p.h = f"{h} = {layout}"
c.save()
c.doCommandByName('restart-leo')
@button big-tree
h = '@string qt-layout-name'
layout = 'big-tree'
p = g.findNodeAnywhere(c, h, exact=False)
if p and p.h.endswith(f" {layout}"):
g.es_print('no change')
else:
p.h = f"{h} = {layout}"
c.save()
c.doCommandByName('restart-leo')
The only difference between the two scripts is the name of the layout.
Edward