Easier docks: status report

84 views
Skip to first unread message

Edward K. Ream

unread,
Sep 6, 2020, 9:34:30 AM9/6/20
to leo-editor
I have just updated devel so that docks are fixed (immovable) unless --init-docks is in effect. This makes it impossible to accidentally change your carefully created dock layout.

One complication remains. There are two ways to use docks, with the --use-docks and --global-docks command-line options. --global-docks implies --use-docks, but not the other way around. You probably should always use one or the other command-line option, because the layout that --init-docks creates depends on which of these two is in effect. If, later, you use the option, the layout won't make any sense.  Clear?

This change is a good start. The second step will be to see whether --global-docks is really necessary. I suspect it is, but I don't remember the details. Surely, new documentation is needed.

All comments welcome. Please let us all know your experiences.

Edward

Edward K. Ream

unread,
Sep 6, 2020, 1:04:12 PM9/6/20
to leo-editor
On Sunday, September 6, 2020 at 8:34:30 AM UTC-5, Edward K. Ream wrote:

> The second step will be to see whether --global-docks is really necessary.

I've carefully reviewed the code. Imo, the --use-docks and --global-docks command-line options should be combined. There seems to be no good reason for two separate switches. We may as well always use global docks. The plan is this:

1: --use-docks will imply --global-docks.
2: --global-docks will imply --use-docks, as at present.
3: --global-docks will be deprecated, with a warning message.

Floating docks and window position

Now (in the docks2 branch) you can only create a floating dock is when --init-docks is in effect.

The next time you open Leo (without --init-docks) Leo will re-float any previously floated dock. Whenever you save a .leo file, Leo will save the position of Leo's main window and the location of any floated docks.

Imo, this is exactly what we want. You set your preferred layout with --init-docks, and then you can select the location of all windows any time you want.

Summary

Leo preserves any changes to the size and location of Leo's main window and any floating docks.

Only testing will show whether unifying --use-docks and --global-docks makes sense. If it does make sense, the --init-docks option should work better, because there is only one dock configuration to remember.

All comments and questions welcome.

Edward

Edward K. Ream

unread,
Sep 6, 2020, 3:41:42 PM9/6/20
to leo-editor
On Sunday, September 6, 2020 at 12:04:12 PM UTC-5, Edward K. Ream wrote:

1: --use-docks will imply --global-docks.
2: --global-docks will imply --use-docks, as at present.
3: --global-docks will be deprecated, with a warning message.

The new code is in devel.  Please test it and report any problems.

Notes

--init-docks also implies --use-docks. This should have been done long ago.

I have not found any need to clear caches.  Just use --use-docks to set up your layout.

I have just closed #1643.  Please reopen if you find problems.

Edward

lewis

unread,
Sep 6, 2020, 7:04:18 PM9/6/20
to leo-e...@googlegroups.com
Ran commit a10b998 with --use-docks option which gave a different layout than last saved. All docks were fixed and I was unable to be update the layout.
I had to run  --init-docks to enable the layout to be updated.

Regards
Lewis

Thomas Passin

unread,
Sep 6, 2020, 8:00:02 PM9/6/20
to leo-editor
There's a hindrance in this new code. Say I have  4 outlines open.  I run Leo with --init-docks and adjust one after another until the tabs are the way I want for all four outlines.  Then I close Leo and re-open if with --use-docks.  All four outlines open and have the same layout as when I closed Leo.  So far, so good.

But if I start a new outline, then it has the default layout, which is not what I want.  I then have to close Leo and re-open with --init-docks, but then I lose the layouts of the four previous tabs.  This behavior not going to be practical; it will irritate users over time.

I suggest that the user needs to be able to designate the layout of a selected outline as the preferred layout, and then all new outlines will open with that layout.  Even better would be to be able to save and apply several layouts by name, like we used to do with the legacy layout system.

Thomas Passin

unread,
Sep 6, 2020, 8:02:26 PM9/6/20
to leo-editor
Also, Add/Delete Body Editor doesn't work any more, at least with --use-docks.  I would be good if it could.

Edward K. Ream

unread,
Sep 7, 2020, 7:29:16 AM9/7/20
to leo-editor


On Sun, Sep 6, 2020 at 6:04 PM lewis <lewi...@operamail.com> wrote:
Ran commit a10998 with --use-docks option which gave a different layout than last saved. All docks were fixed and I was unable to be update the layout.
I had to run  --init-docks to enable the layout to be updated.

This is expected. --use-docks is now the same as --global-docks, so the layout would change. This kind of confusion between the --use-docks and --global-docks layouts won't happen again.

When I awoke this morning I realized that the acid test is to use --init-docks on two different files, with two different layouts.  We want those different layouts to persist depending on the file. I just ran those tests and everything appears to work.

In short: per-.leo-file layouts work. The only hard part is setting up the layouts with --init-docks. Once you have done that, you can't accidentally change a layout.

Edward

Edward K. Ream

unread,
Sep 7, 2020, 7:34:42 AM9/7/20
to leo-editor
On Sun, Sep 6, 2020 at 7:00 PM Thomas Passin <tbp1...@gmail.com> wrote:

... if I start a new outline, then it has the default layout, which is not what I want.

Let me see what I can do.

 I suggest that the user needs to be able to designate the layout of a selected outline as the preferred layout...

The first .leo file loaded probably controls all loaded .leo files. This should apply to new files too.

I have just reopened #1643.

Edward

Edward K. Ream

unread,
Sep 7, 2020, 7:38:18 AM9/7/20
to leo-editor
On Sun, Sep 6, 2020 at 7:02 PM Thomas Passin <tbp1...@gmail.com> wrote:

Also, Add/Delete Body Editor doesn't work any more, at least with --use-docks.

Both work for me from both the Window menu and from the minibuffer.

Edward

Edward K. Ream

unread,
Sep 7, 2020, 9:22:57 AM9/7/20
to leo-editor
I've played around with docks for awhile.  Here are my tentative conclusions.

You can specify the desired layout of new outlines as follows:

- Open some file, say x.leo, with --init-docks.
- Open a new file. Set the layout as you like.
- Close the new file.
- Save x.leo.

After this, opening Leo with --use-docks, the layout of new outlines should be as you set it above.

For reasons I do not understand, floating docks seem to work only on the first outline loaded.

I'm reluctant to make significant changes to the code. It's already beyond the limit of my full understanding.

Please let me know if these workarounds work for you.

Edward

Thomas Passin

unread,
Sep 7, 2020, 10:09:59 AM9/7/20
to leo-editor
On Monday, September 7, 2020 at 9:22:57 AM UTC-4, Edward K. Ream wrote:

You can specify the desired layout of new outlines as follows:

- Open some file, say x.leo, with --init-docks.
- Open a new file. Set the layout as you like.
- Close the new file.
- Save x.leo.

After this, opening Leo with --use-docks, the layout of new outlines should be as you set it above.

Not when I just tried it.  New outlines still open with the undesired Leo-default layout.

Leo 6.3-devel, devel branch, build c5f8d4cc33
2020-09-07 06:21:51 -0500
Python 3.8.2, PyQt version 5.15.0
Windows 10 AMD64 (build 10.0.18362) SP0

Not only that, but in the default layout, when I open VR3 and then close it, it doesn't close but instead opens a second VR3 pane when --init-docks is in effect.

Anyway, the whole workaround procedure is not really workable for most people, and *really* unworkable for new users of Leo.

If the code is at the limits of your understanding, then if we believe Kernigan's Law, you won't be able to debug it.  Maybe this is not the best place to be.

Thomas Passin

unread,
Sep 7, 2020, 10:18:57 AM9/7/20
to leo-editor
Just now, after I went through several rounds of --init-docks/fix layout/--use-docks one after another on the four files I want to have open at once, and then I reopened Leo, one of the outlines opened in the --init-docks configuration even though I had used --use-docks.

The whole thing is just unworkable as it is.  Not that I have any useful suggestions myself.  I don't have a clue about how this all works.

Edward K. Ream

unread,
Sep 7, 2020, 11:28:14 AM9/7/20
to leo-editor
On Monday, September 7, 2020 at 8:22:57 AM UTC-5, Edward K. Ream wrote:

For reasons I do not understand, floating docks seem to work only on the first outline loaded.

The fix is in devel. All docks are now floatable.

Edward

Edward K. Ream

unread,
Sep 7, 2020, 11:29:58 AM9/7/20
to leo-editor
On Monday, September 7, 2020 at 9:18:57 AM UTC-5, Thomas Passin wrote:

Just now, after I went through several rounds of --init-docks/fix layout/--use-docks one after another on the four files I want to have open at once, and then I reopened Leo, one of the outlines opened in the --init-docks configuration even though I had used --use-docks.

The whole thing is just unworkable as it is.

I don't think things are as bad as that. I'm not getting too many surprises myself.

Edward

Thomas Passin

unread,
Sep 7, 2020, 9:50:28 PM9/7/20
to leo-editor
Ah, I see.  Add/Delete Body Editor with --use-docks did open/close a new editor, but it was so tiny I didn't see it, free-floating in the upper left, and this tiny window could not be moved or resized.

Mike Hodson

unread,
Sep 8, 2020, 1:02:43 AM9/8/20
to leo-e...@googlegroups.com
All this dock discussion makes me want to download the latest sources and try and see how much of a kerfuffle this has become..

Without having used Leo in .. over 3 years or so now, I want to see how it feels to use it in a far newer default state, then configure it again. 

At least to me, generic dock UX should be something like this:
You have docks. 
They can move. 
They should instantly save in the current open leo file as how they are when moved.  In generic apps the dock layout should save to the config and reload upon app relaunch, but Leo is very outline-specific in how things work, so we keep the dock tied to the outline.
They should be reloaded from the leo file when opened.
There should be some gui options, menu item, something, "Save current dock state as default". "Reset docks to Leo default".
Perhaps there could be a "load dock state from saved" that would modify the current dock state to that of a different Leo file without opening the Leo file as a working edit.
Enable and Disable toggles should be visible in the GUI and not commandline options because they are graphical elements of the program. Something that is implicitly graphical to modify should also be graphical to enable, save, etc. 

My 2 cents, adjusted for inflation.

Mike



Edward K. Ream

unread,
Sep 8, 2020, 9:43:27 AM9/8/20
to leo-editor
On Tue, Sep 8, 2020 at 12:02 AM Mike Hodson <mys...@gmail.com> wrote:

At least to me, generic dock UX should be something like this:

Thank you for your comments. We both agree that docks should "just work", but what that means requires consideration of many hidden details.
You have docks. 
They can move. 

The layout of docks can only change the layout if --init-docks is true. This prevents unintended layout changes. Alas, it's not always possible to undo changes to Qt dock via the UX. In particular, moving the VR pane out of the body pane can't be undone. If you mistakenly do that, the only remedy is to start over again with --init-docks.

Within a specific layout, you can change the size of docks by moving dividers. For floating docks, you can move them anywhere on the screen.

They should instantly save in the current open leo file as how they are when moved. 

Leo does save all layouts, either when the .leo file closes, or when Leo closes, whichever comes first.  You can see this in action with --trace=dock
In generic apps the dock layout should save to the config and reload upon app relaunch, but Leo is very outline-specific in how things work, so we keep the dock tied to the outline.

There is an option to set what Qt calls the "central widget". By default this is the outline pane.

They should be reloaded from the leo file when opened.

That is what happens. I am trying to simplify the behind-the-scenes details.
There should be some gui options, menu item, something, "Save current dock state as default". "Reset docks to Leo default".

This has been requested several times. Imo, it would be better to use the layout of the first loaded .leo file as the default for new files.

I am presently struggling with what happens when the first specified .leo file does not exist. There is already a mechanism for using a hand-created layout as a very last resort, but just now there are problems.
Perhaps there could be a "load dock state from saved" that would modify the current dock state to that of a different Leo file without opening the Leo file as a working edit.

This is possible, I think. However, I would prefer to simplify matters, not add yet more complications.
Enable and Disable toggles should be visible in the GUI and not commandline options because they are graphical elements of the program. Something that is implicitly graphical to modify should also be graphical to enable, save, etc. 

--use-docks must be a command-line option because it affects the early stages of Leo's startup code. By the time any Leo outline becomes visible it is too late to change anything.

I am presently deep into testing and experimentation. The goal is to eliminate duplicate code and reduce the number of paths through the code. It's worth a lot of work to make things as simple and easy-to-use as possible.

Edward
Reply all
Reply to author
Forward
0 new messages