Status report: #1289: singleton docks

32 views
Skip to first unread message

Edward K. Ream

unread,
Aug 23, 2019, 2:57:24 AM8/23/19
to leo-editor
#1289 is a precondition for pyzo in Leo.  There was big progress yesterday.

Status

The code creates an Outlines dock, containing one tab for each Leo outline. Each of these tabs contains what might loosely be called an outline window, containing Leo's familiar Outline, Body and Tabs panes/docks. Each of tab (outline window) works exactly as before.

Refactoring is largely complete.  Leo's legacy DynamicWindow class remains exactly as it always has been. This is why each tab in the Outlines dock works as before.  It's a very welcome development.

Global vs local docks

I struggled with refactoring until the distinction between global and local docks arose:

Global docks are singletons shared by all of Leo's code. All of pyzo's docks must be global, with the possible exception of the File Browser dock.

Each outline window creates (and has always created) its own local docks. There are good reasons to retain local docks.  Users can arrange docks in each outline as they like, independently of other outlines.

Remaining work

The present code lacks some important code from the legacy LeoTabbedTopLevel and TabbedFrameFactory classes.  The relevant code will likely migrate to a new, singleton, OutlinesTabs class.

While investigating startup issues, I saw the need for #1291. This issue isn't essential for singleton docks, but I'll probably do it soon, in yet another git branch.

Summary

After a period of confusion, yesterday saw rapid progress. The distinction between global and local docks ended lots of confusion.

Considerable work remains, but the remaining work should be straightforward.

Edward

Edward K. Ream

unread,
Aug 23, 2019, 8:26:57 AM8/23/19
to leo-editor
On Fri, Aug 23, 2019 at 1:57 AM Edward K. Ream <edre...@gmail.com> wrote:

#1289 is a precondition for pyzo in Leo.  There was big progress yesterday.

A few more notes:

As of rev cf990e3, the new Outlines dock is always Qt's central widget (in the gui branch, that is)  This seems fine, so perhaps we can eliminate the @string central-dock-widget setting.

A subtlety: The Outlines dock is a global dock, but each of its tabs contains local docks. This is as it must be.  Btw, pyzo's central widget is not a dock at all, but within Leo it will be embedding in a global Files dock.

Most pyzo docks must be global docks, for the following reasons:

- Most importantly, pyzo's code implicitly assumes they are all singletons.
- Initializing pyzo's Shells dock takes a long time. We don't want to do that when creating a new outline!
- We don't want to force the user to rearrange all those pyzo docks when creating a new Leo outline!

We could make an exception for pyzo's File Browser dock.  It would go into the Tabs dock by default.  So each outline would control the visibility and the location of the File Browser.  Otoh, it's probably just as well to keep it as a global dock.

Edward

Chris George

unread,
Aug 23, 2019, 8:40:32 AM8/23/19
to leo-editor
I will once again put my hand up to try to preserve the ability to make the body dock the central widget. It is central to how I work with Leo. I have quickly become fond of the two-pane workspace and that falls apart if my only option is to nest the widgets on top of the body instead of the tree.

I have tried to make the central outline work for me but I just can't seem to go back to a three-pane UI, not after seeing what is possible with two panes, using three for special cases only.

Chris

--
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 leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3e_yDhMZCG_sxzpYVW0HdMX214Aw0qe3Eq-YOT2bTSJQ%40mail.gmail.com.

Edward K. Ream

unread,
Aug 23, 2019, 8:51:16 AM8/23/19
to leo-editor
On Fri, Aug 23, 2019 at 7:40 AM Chris George <techn...@gmail.com> wrote:
I will once again put my hand up to try to preserve the ability to make the body dock the central widget.

I'll keep this in mind.  Remember, though, that there may be several body docks in an outline.  We'll have to see what works.

Remember also that the gui branch still needs a lot of work.

Edward

Edward K. Ream

unread,
Aug 23, 2019, 12:09:52 PM8/23/19
to leo-editor
On Friday, August 23, 2019 at 7:40:32 AM UTC-5, Chris George wrote:

I will once again put my hand up to try to preserve the ability to make the body dock the central widget.

I'm very glad you mentioned this. It got me thinking about QMainWindows. Turns out that I forget that DynamicWindows (Leo's main window) are actually QMainWindows, even in the gui branch.  This means that, yes, any pane can be the central widget for that QMainWindow.

Somehow Qt seems to be able manage all those central widgets with the 6.0 code base, so I suppose adding one more won't hurt.  We shall see.

More importantly, this suggests using Leo's existing code almost completely unchanged.  I have just created the gui2 branch, based on the gui branch, for this experiment.

If we're lucky, qt_gui.__init__ can embed the a TabbedTopLevel into the new Outlines (plural) dock.  Everything might "just work".  We'll see.  If it does work, almost everything will stay just as it is.  Ivars such as leo_master might have to change.  Etc. It's worth fighting for.

Edward

Edward K. Ream

unread,
Aug 23, 2019, 2:17:56 PM8/23/19
to leo-editor
On Fri, Aug 23, 2019 at 11:09 AM Edward K. Ream <edre...@gmail.com> wrote:

> More importantly, this suggests using Leo's existing code almost completely unchanged.  I have just created the gui2 branch, based on the gui branch, for this experiment.

The experiment was successful. I've merged gui2 back into the gui branch.  There are quite a few loose ends.  I'll be working on them next.

The Outlines dock looks here to stay.  Whether that causes layout problems remains to be seen.

Edward
Reply all
Reply to author
Forward
0 new messages