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: Make Matplotlib status bar widget show the right backend and fix some errors related to kernel restarts for options that require them #22057

Merged
merged 15 commits into from
May 6, 2024

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented May 5, 2024

Description of Changes

  • The widget was not showing the actual backend but instead Interactive for interactive backends.
  • Make the widget show the right backend after kernel restarts.
  • Hide the widget on kernel failure or if Matplotlib is not available in the kernel (there's no need to show it if there's nothing to report)
  • Make pylab/autoload option require a kernel restart (that's necessary when disabled so that the Numpy and Matplotlib star imports are removed).
  • Fix applying several options that require a kernel restart (before we were applying only the first option).
  • Expand tests to cover most of these changes.
  • Depends on PR: Fix Matplotlib interactive backend detection spyder-kernels#485

Visual changes

  • Move text about backend options to a tip in the IPython console config page

    Before After
    imagen imagen
  • Improve UI/UX of ConsoleRestartDialog

    Before After
    imagen imagen

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:

That's because `update` is a public Qt method.
- Before we were showing "Interactive" when "Inline" was not selected,
but that's not an actual backend name, and that could cause confusion to
users.
- Also, rename the Qt5 and Tkinter backends in Preferences to Qt and Tk,
respectively, because those are the names used by Matplotlib. So, the
interface will reflect exactly what users see in the console when
changing backends.
- Use radio buttons instead of checkboxes because they are the right
graphical elements for it.
- Add a new radio button to keep the existing kernels.
- Indent radio buttons a bit to make them stand out from the text.
The previous code only worked to switch between Qt and Inline
- Also, improve the tooltip of that widget a bit.
- That's necessary because it's not simple to remove the imports it
injects into the namespace.
- Also, improve text related to it in its confpage.
…estart

- Before we were applying only one option of several that need a
restart.
- This also improves the heuristic to decide when to show the kernel
restart dialog and debounces the restart_kernel method so that we don't
try to run it several times in a row after many change options that
require a restart.
We also hide it if Matplotlib is not present in the kernel or failed to
import there.
…s.git --branch=mpl-fixes --update --force external-deps/spyder-kernels

subrepo:
  subdir:   "external-deps/spyder-kernels"
  merged:   "2bc468762"
upstream:
  origin:   "https://github.com/ccordoba12/spyder-kernels.git"
  branch:   "mpl-fixes"
  commit:   "2bc468762"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"
@ccordoba12 ccordoba12 added this to the v6.0beta1 milestone May 5, 2024
@ccordoba12 ccordoba12 self-assigned this May 5, 2024
@ccordoba12 ccordoba12 changed the title PR: Make Matplotlib status bar widget show the right backend and other fixes related to kernel restarts for options that require them PR: Make Matplotlib status bar widget show the right backend and fixes related to kernel restarts for options that require them May 5, 2024
- Now we check if we request a restart by switch between different
backends several times.
- We also check that the Matplotlib status widget displays the right
value.
@ccordoba12 ccordoba12 force-pushed the fix-mpl-statusbar-widget branch 3 times, most recently from ed2d64f to f4c4b24 Compare May 5, 2024 06:33
- That prevents that handlers registered by other objects are called
first, which was causing errors since the shell handlers are more
fundamental and will actually be called first.
- Also, fix test_startup_run_lines_project_directory because it was
trying to get a value as soon as the kernel is ready, which was
generating an error since MatplotlibStatus is checking if Matplotlib is
available at the same time.
@ccordoba12 ccordoba12 force-pushed the fix-mpl-statusbar-widget branch 3 times, most recently from f52e1f4 to 1458f76 Compare May 5, 2024 17:25
- Also, make a small UI fix for ConsoleRestartDialog on Mac.
@ccordoba12 ccordoba12 changed the title PR: Make Matplotlib status bar widget show the right backend and fixes related to kernel restarts for options that require them PR: Make Matplotlib status bar widget show the right backend and fix some errors related to kernel restarts for options that require them May 5, 2024
…r-kernels.git --branch=master --update --force external-deps/spyder-kernels

subrepo:
  subdir:   "external-deps/spyder-kernels"
  merged:   "4ecb144341"
upstream:
  origin:   "https://github.com/spyder-ide/spyder-kernels.git"
  branch:   "master"
  commit:   "4ecb144341"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

[ci skip]
@ccordoba12 ccordoba12 merged commit 071e646 into spyder-ide:master May 6, 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.

None yet

1 participant