Skip to content

Mac qt ctrl #21142

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

Merged
merged 3 commits into from
Sep 22, 2021
Merged

Mac qt ctrl #21142

merged 3 commits into from
Sep 22, 2021

Conversation

tacaswell
Copy link
Member

PR Summary

closes #21110

This fixes the QT tests to pass on OSX and tries to enable running them on GHA.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

The alias SIGCLD for SIGCHLD does not exist on OSX
@tacaswell tacaswell added this to the v3.5.0 milestone Sep 20, 2021
Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

This works for me locally, it also looks like it is being hit in CI now (there are no skips in test_backend_qt on macos-latest). Just one minor comment for readability.

(
"Key_A",
["ControlModifier"],
("ctrl+a" if sys.platform != "darwin" else "cmd+a"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I find the previous version a little easier to read with more on a single line. Perhaps you could leave the parametrize section alone and put the switch inside the function?

if sys.platform == "darwin":
    qt_mods.replace("ctrl", "cmd")

Copy link
Member Author

Choose a reason for hiding this comment

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

fair, that did not occur to me to try! I was going going through the failing tests one at a time and putting the fix in.

On the other hand, changing the parameters makes it clear from looking at the test the expected behavior is which might be clearer in the long run?

'\N{LATIN CAPITAL LETTER A WITH ACUTE}'),
('Key_Aacute', [],
'\N{LATIN SMALL LETTER A WITH ACUTE}'),
('Key_Control', ['AltModifier'], 'alt+control'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why this is "control" rather than "ctrl" here, but it appears to work either way for me locally, and this would get you an easier string replacement.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the issue is that in some cases it is 'ctrl' because it is a modifier, but here it is 'control' because it is the key. If this distinction is a good idea or not is a different issue, but this fails on linux if we change control -> ctrl here.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

There's something wrong with 'ctrl' vs. 'control'.

skip pyside2 on GHA because it is segfaulting with openGL issues
Due to some re-(re)-mapping of the modifier keys by the OSX keyboard,
then by Qt, and then by us there is an inconsistency between the
platforms.

This change to the tests encodes what the Qt on OSX currently does (and
to our understand have always done).
@timhoffm timhoffm merged commit 98d6a30 into matplotlib:master Sep 22, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 22, 2021
QuLogic added a commit that referenced this pull request Sep 22, 2021
…142-on-v3.5.x

Backport PR #21142 on branch v3.5.x (Mac qt ctrl)
@tacaswell tacaswell deleted the mac_qt_ctrl branch September 22, 2021 14:59
tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull request Oct 12, 2021
tacaswell pushed a commit that referenced this pull request Oct 20, 2021
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.

Qt swapping ctrl and cmd on OSX
3 participants