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

PR: Remember undocked state of plugins when closed and allow to close Outline when the Editor is maximized or in an Editor window #19784

Merged
merged 30 commits into from
May 25, 2024

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Oct 11, 2022

Description of Changes

  • If a plugin is closed when it's undocked by going to View > Panes, then it'll be automatically undocked when made visible again.
  • Add a new Close action to the Options menu of undocked plugins, so that this new functionality can be more easily discovered by users.
  • If a plugin is closed while undocked, also close it when clicking on the Close button of its window. This means that if users want to dock it again, they'll need to click on the Dock action of the respective plugin.
  • Allow users to close the Outline when shown next to the maximized editor and in editor windows.
  • Rename Unlock position in the Options menu of plugins to Move. This is because Unlock and Undock differ by a single letter in English, so it's quite easy to click on one of those actions when you really want to click on the other (I made that mistake constantly while working on this PR).

API changes

  • Use SpyderMenuMixin to create main window menus. That allows to easily access and use them in other places (e.g. in EditorMainwindow).
  • Make render method of SpyderToolbar public. This follows a similar change done for SpyderMenu.
  • Add toolbar_id to the constructor of ApplicationToolbar. That allows to more easily create those toolbars.
  • Register toolbar toggle view actions in ACTION_REGISTRY to access them easily (e.g. for testing).

Visual changes

New close when undocked functionality

close-undocked-1

close-undocked-2

New close action in undocked plugins

image

Changes in EditorMainWindow

imagen

imagen

Issue(s) Resolved

Fixes #16265.

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: @ccordoba12.

@ccordoba12
Copy link
Member Author

Leaving this for 5.4.1 so I can gather feedback from other devs during our developers meeting.

@ccordoba12 ccordoba12 modified the milestones: v5.4.0, v5.4.1 Oct 18, 2022
@ccordoba12 ccordoba12 modified the milestones: v5.4.1, v6.0alpha1 Dec 6, 2022
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha1, v6.0alpha2 Jun 8, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha2, v6.0alpha3 Aug 4, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha3, v6.0beta1 Nov 17, 2023
@ccordoba12 ccordoba12 changed the base branch from 5.x to master December 23, 2023 15:10
- This allows users to show plugins directly undocked, i.e. without
making them first visible but docked on the main window to then undock
them.
- Also, improve typing a bit.
- To close it the user can click the Close action in its Options menu or
go to the Panes menu.
- Hide the Outline's Undock and Lock/unlock actions when shown in the
maximized editor because it doesn't make sense to show them in that
case.
@ccordoba12 ccordoba12 changed the title [WIP] PR: Remember undocked state of plugins when closed PR: Remember undocked state of plugins when closed and migrate EditorMainWindow to the new API Dec 28, 2023
@ccordoba12 ccordoba12 changed the title PR: Remember undocked state of plugins when closed and migrate EditorMainWindow to the new API PR: Remember undocked state of plugins when closed, allow to close Outline when the Editor is maximized and migrate EditorMainWindow to the new API Dec 28, 2023
- That way it can be used by other plugins or widgets.
- Use it to set the menubar stylesheet of EditorMainWindow.
- Also, fix failing tests for the Working directory.
Also, check for the presence of splitter handler because it can't be
available during tests.
This was causing a crash at startup in some cases.
@ccordoba12
Copy link
Member Author

@dalthviz, this is finally ready for review. It ended up being a big PR because I decided to migrate EditorMainWindow to the new API to allow users to close the Outline when working with it. I also expanded our test suite to cover the new functionality added here.

Copy link
Member

@jitseniesen jitseniesen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is one problem that needs to be addressed before this can be merged:

  • When the Outline pane is undocked, there is still an "Undock" action in its options menu, and clicking that leads to a core dump.

The rest is just feedback for your consideration:

  • I would change "Move to another position" to "Move", because moving something means moving it to another position. I don't think I have ever seen this spelled out in a menu.
  • I don't like that "Close" in options menu of undocked panes is different from the "Close" button. The latter sometimes hides and sometimes docks. But this seems a conscious decision on your part, so fair enough.
  • If I maximize the editor pane and then click on View > Window Layouts > Spyder default layout, the result is strange and kind of halfway between the maximized layout and the default layout. But this is probably not related to the PR.
  • Minor code comments.

spyder/utils/stylesheet.py Outdated Show resolved Hide resolved
spyder/utils/stylesheet.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/window.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/window.py Outdated Show resolved Hide resolved
@ccordoba12 ccordoba12 removed the request for review from dalthviz February 5, 2024 00:45
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha4, v6.0beta1 Feb 6, 2024
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha5, v6.0beta1 Mar 12, 2024
@ccordoba12 ccordoba12 modified the milestones: v6.0beta1, v6.0beta2 May 10, 2024
ccordoba12 and others added 8 commits May 15, 2024 23:33
- Also, remove unnecessary condition in test_undock_plugin_and_close and
style from the app stylesheet.
Co-authored-by: Jitse Niesen <jitseniesen@yahoo.com>
This helps to have a more straightforward UI because "Move" means
basically "Move to another position". And "Lock" means "Lock position".
- We were not unmaximizing a possibly maximized plugin before the
switch, which left the window in an inconsistent state.
- We also need to reapply the dock tabbar style after the switch so the
window looks as expected.
@ccordoba12
Copy link
Member Author

@jitseniesen, this is ready for another review. About your comments:

When the Outline pane is undocked, there is still an "Undock" action in its options menu, and clicking that leads to a core dump.

Thanks for noticing it. I was able to easily reproduce it and it should be fixed now.

I would change "Move to another position" to "Move", because moving something means moving it to another position. I don't think I have ever seen this spelled out in a menu.

Great suggestion! I implemented it in one of my last commits.

I don't like that "Close" in options menu of undocked panes is different from the "Close" button. The latter sometimes hides and sometimes docks. But this seems a conscious decision on your part, so fair enough.

We'll see what users think about this UX.

If I maximize the editor pane and then click on View > Window Layouts > Spyder default layout, the result is strange and kind of halfway between the maximized layout and the default layout. But this is probably not related to the PR.

Great catch! Although not related to the changes here (as you suspected), I took the opportunity to fix it as well.

Copy link
Member

@jitseniesen jitseniesen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, no further comments. Thanks!

@ccordoba12
Copy link
Member Author

Since the failure in our tests was already fixed by PR #22100, I'm going to merge this one.

@ccordoba12 ccordoba12 merged commit 543dc35 into spyder-ide:master May 25, 2024
13 of 14 checks passed
@ccordoba12 ccordoba12 deleted the make-close-and-dock-different branch May 25, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outline pane is automatically shown when editor is maximized
2 participants