Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dock area fixes #469

Merged
merged 8 commits into from
Jan 28, 2022
Merged

Dock area fixes #469

merged 8 commits into from
Jan 28, 2022

Conversation

MatthieuDartiailh
Copy link
Member

While investigating and fixing #467, I found a bunch of other issues that this PR addresses along with #467.

I do not have time to wind up the unit tests this deserves so I would appreciate if anybody can stress test this is a bit before merging. Each commit addresses a specific issue and can be reviewed independently. Hopefully commit messages are clear.

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2022

Codecov Report

Merging #469 (72db305) into main (e9e1f30) will increase coverage by 0.01%.
The diff coverage is 54.28%.

@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   73.30%   73.31%   +0.01%     
==========================================
  Files         316      316              
  Lines       24104    24121      +17     
  Branches       55       55              
==========================================
+ Hits        17669    17684      +15     
- Misses       6435     6437       +2     

@bburan
Copy link
Contributor

bburan commented Jan 21, 2022

I played around with this using psiexperiment and it seems to work fine. However, I did notice some additional behavior quirks with the behavior of the dock area that I had not noticed before. These quirks are present in main as well, so not a side-effect of this PR. For example:

In the following screenshot, there is an "x" indicating that we could close the tab group. Yet, it is not active because at least one item in the tab group cannot be closed (e.g., closable attribute is set to False). When all items can be closed, it does work (and closes them all out).

image

I wonder if the "x" should not be shown if it will have no behavior?

@MatthieuDartiailh
Copy link
Member Author

Thanks for testing. We could either hide the x or close only all closable tabs and use a more specific tool tip. WDYT ?

Either way I will try to include the fix in this PR.

@bburan
Copy link
Contributor

bburan commented Jan 21, 2022

@MatthieuDartiailh I would argue for hiding the x since it seems counter-intuitive to show the x if it does not actually have the capability to close out all tabs (regardless of closability of each tab and/or the tooltip shown).

@MatthieuDartiailh
Copy link
Member Author

MatthieuDartiailh commented Jan 21, 2022

Ok. I guess what I have in mind would make more sense as an entry in a context menu (I am thinking VS Code like, close all, close right, ...). But this I will leave this for later.

@sccolbert
Copy link
Member

sccolbert commented Jan 22, 2022 via email

@MatthieuDartiailh
Copy link
Member Author

When closing a floating window non closable items or items whose closing is vetoed are re-floated and it works fine. The case of @bburan is specific to tabs floating or not and the handling of closing the whole notebook.

This allows to remove the item from the layout before closing it. Otherwise qt closes the widget backing the enaml declaration too early because it is parented to the layout which is destroyed when the floating window (which has no declarative equivalent) is destroyed.
This also fixes handling of placeholder item when the surrounding layout is not a splitter.
Previously the window would close as soon as the dock item is removed before it can be re-added as a pinned item.
@MatthieuDartiailh
Copy link
Member Author

@bburan I updated the code to hide the close button on the tabs if no item can be closed. This is closer to the old behavior while being more correct. I feel it could also be more convenient when there are many tabs and a single one cannot be closed. Let me know if you find anything else. I will plan to merge next week if nobody complains in the meantime.

@bburan
Copy link
Contributor

bburan commented Jan 25, 2022 via email

@MatthieuDartiailh
Copy link
Member Author

At one point this will call for tests but I will merge as is for the time being.

@MatthieuDartiailh MatthieuDartiailh merged commit 5be91cd into main Jan 28, 2022
@MatthieuDartiailh MatthieuDartiailh deleted the dock-area-fixes branch January 28, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants