"1. Besides the original helper, g.app.gui.*find_widget_by_name*, we'll 
want g.app.gui.*restore_layout*. This helper will use the "split direction" 
setting. It should be straightforward to create this helper."

I'm not so sure it will be straightforward.  That's because a given layout 
might have created new splitters and new widgets to go into them.  They 
will need to be discovered and deleted, which destruction could be 
object-specific. I'm not saying it can't be done, just that it doesn't seem 
so straightforward to me.

One possibility could be that layouts will be created using dedicated 
method calls that would keep a record of new widgets involved with a layout 
and their locations.  I suppose that this record should use weak references 
so that an object would actually be deleted by a delete operation and not 
accidentally kept as a zombie because a reference in the layout record 
didn't get removed.

I think that an undo sequence as the reverse of the creation sequence ought 
to be practical.  For example, the creation of a layout:

1. move log frame from secondary to main splitter;
2. move body editor frame from main to secondary;
3. move log frame from main to secondary;
4. create new splitter in main splitter;
5. create new myPluginWidget;
6. insert myPluginWidget into the new splitter.

Moving from 6 to 1 using the inverse operations ought to undo the new 
layout:

6. remove myPluginWidget from the new splitter;
5. delete  myPluginWidget;
4. delete the new splitter;
3. move log frame from secondary to main;
2. move body editor frame from secondary to main;
1. move log frame from main to secondary.

I haven't thought too hard about it but I hope all these operations will 
turn out to be commutative.  Otherwise things will be trickier.
On Friday, July 19, 2024 at 9:13:21 AM UTC-4 Edward K. Ream wrote:

> On Fri, Jul 19, 2024 at 7:32 AM Thomas Passin <[email protected]> wrote:
>
>> I pictured a layout plugin doing it work by running one of those 
>> scripts...
>>
>
> The big picture is coming into focus:
>
> 1. Besides the original helper, g.app.gui.*find_widget_by_name*, we'll 
> want g.app.gui.*restore_layout*. This helper will use the "split 
> direction" setting. It should be straightforward to create this helper.
>
> 2. We'll probably want four new Qt gui commands to change layouts. There 
> may be no need for plugins or `@button` scripts!
>
> And that's it.
>
> 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/27145069-9ced-483e-9b7d-368a8103d47fn%40googlegroups.com.

Reply via email to