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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

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. This required migrating EditorMainWindow to the new API.
  • Rename Unlock position in the Options menu of plugins to Move to another position. 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
@ccordoba12 ccordoba12 changed the title PR: Remember undocked state of plugins when closed, allow to close Outline when the Editor is maximized or in an Editor window PR: Remember undocked state of plugins when closed and allow to close Outline when the Editor is maximized or in an Editor window Dec 28, 2023
…g system

That allows to make persistent that state across Spyder sessions.
That will allow us to use it in other tests.
- Also, check the visibility of the Outline when shown with the
maximized editor.
- Fix test_no_update_outline because it was failing.
- Reduce their size to make them a bit smaller than the QMainWindow
separators. That will help users to navigate our UI more easily.
- Also, remove images of QMainWindow separators because they are not
visible.
This will present to users the same UI as the one shown when the editor
is maximized.
This will allow us to reuse those menus in other places they are needed.
- This will allow us to easily access them in other places.
- Also, fix typing and improve code style in its container.
That way it'll be easier to create those kind of toolbars in other
widgets.
This provides a very similar UX to the one users see when maximizing the
editor in the main window.
- This preserves the checked state of new Outline action shown in the
View menu.
- It also removes the handle which looks like an extra and odd border in
the window.
- 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.

marginBottom='0px',
# This is summed to the separator padding (2px)
width="3px",
# The default iamge is not visiblw at this size
Copy link
Member

Choose a reason for hiding this comment

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

This comment has two typos and can also be written clearer.

Suggested change
# The default iamge is not visiblw at this size
# Hide image because the default image is not visible at this size

height='3px'
# This is summed to the separator padding (2px)
height='3px',
# The default iamge is not visiblw at this size
Copy link
Member

Choose a reason for hiding this comment

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

As above.

Suggested change
# The default iamge is not visiblw at this size
# Hide image because the default image is not visible at this size


# ---- Widgets
# -----------------------------------------------------------------------------
class OutlineExplorerinEditorWindow(OutlineExplorerWidget):
Copy link
Member

Choose a reason for hiding this comment

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

Consistency in CamelCase capitalization.

Suggested change
class OutlineExplorerinEditorWindow(OutlineExplorerWidget):
class OutlineExplorerInEditorWindow(OutlineExplorerWidget):

self.outlineexplorer = None
if outline_plugin is not None:
self.outlineexplorer = OutlineExplorerWidget(
self.outlineexplorer = OutlineExplorerinEditorWindow(
Copy link
Member

Choose a reason for hiding this comment

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

As above.

Suggested change
self.outlineexplorer = OutlineExplorerinEditorWindow(
self.outlineexplorer = OutlineExplorerInEditorWindow(

@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
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