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: Improve Maintain focus in the editor option and unmaximize plugins when running/debugging code #18928

Merged
merged 19 commits into from
Aug 9, 2022

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Aug 3, 2022

Description of Changes

  • Avoid giving focus to the IPython console when it's undocked, the user runs/debugs code and Maintain focus to editor is enabled.
  • Keep focus in the editor in any run or debug operation and that option is enabled.
  • Unmaximize any plugin before running or debugging code.
  • Correctly set the state of the Maximize button when unmaximizing a plugin programmatically from other plugins (this was totally broken).
  • Add sig_unmaximize_plugin_requested to SpyderPluginV2 so that plugins can request to unmaximize the currently maximized plugin from others programmatically.
  • Add unmaximize_dockwidget and unmaximize_other_dockwidget methods to the Layout plugin. Also move switch_to_plugin to it.
  • Expand tests to catch possible regressions in the future.

Issue(s) Resolved

Fixes #3221

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

This is to be consistent with the same behavior for cells.
Now we maintain the focus in the editor after running or debugging
files, cells or selections.
This allows us to correctly set its state when calling switch_to_plugin
from plugins programmatically.
- The lack of this made that the calls to switch_to_plugin did nothing
when plugins were maximized.
- Fix several bugs with switch_to_plugin and the interaction between new
and old API plugins.
@ccordoba12 ccordoba12 added this to the v5.3.3 milestone Aug 3, 2022
@ccordoba12 ccordoba12 requested a review from dalthviz August 3, 2022 22:36
@ccordoba12 ccordoba12 self-assigned this Aug 3, 2022
@pep8speaks
Copy link

pep8speaks commented Aug 3, 2022

Hello @ccordoba12! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 202:43: E114 indentation is not a multiple of four (comment)
Line 202:43: E116 unexpected indentation (comment)

Comment last updated at 2022-08-09 00:09:43 UTC

@ccordoba12 ccordoba12 changed the title PR: Fix Maintain focus in the editor option and unmaximize plugins when running/debugging code PR: Improve Maintain focus in the editor option and unmaximize plugins when running/debugging code Aug 4, 2022
Instead add unmaximize_dockwidget to Layouts and use it where needed.
This goes well with the already existing method close_window
- This makes all these operations consistent with respect to
unmaximizing plugins. Before only running and debugging a file did
that.
- Also expand and simplify tests due to this change
- That makes easier to call that method from other plugins.
- Fix call to run_script from Files/Projects, which was broken after
adding the focus_to_editor arg to it.
Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

Thanks @ccordoba12 ! Checking locally seems like the changes are working as expected and I left some questions regarding code placement.

Otherwise this LGTM 👍

Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
@dalthviz
Copy link
Member

dalthviz commented Aug 8, 2022

Checking locally this again seems like closing the Tour leaves the Maximize toolbar button in a incoherent state (it remains checked although the unmaximized action was done). Also, after closing the tour, should the plugins previously maximized be again maximized @ccordoba12 ? Maybe this was an issue before?

focus_tour

That way it'll be easier for external plugin developers to ask for this
programmatically.
@ccordoba12
Copy link
Member Author

Checking locally this again seems like closing the Tour leaves the Maximize toolbar button in a incoherent state (it remains checked although the unmaximized action was done)

Thanks @dalthviz for manually checking that! I only connected the new sig_unmaximize_plugin_requested signal for dockable plugins, but the Tours plugin is not dockable. That's why it was not having effect.

I fixed that in my last commit and force pushed it again.

Also, after closing the tour, should the plugins previously maximized be again maximized @ccordoba12 ? Maybe this was an issue before?

Yep, that was the case before. Since that's a minor thing, I think we should leave it for later.

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

👍🏼

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.

3 participants