8000 Cleanups to Qt backend. by anntzer · Pull Request #17070 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Cleanups to Qt backend. #17070

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 1 commit into from
Apr 12, 2020
Merged

Cleanups to Qt backend. #17070

merged 1 commit into from
Apr 12, 2020

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Apr 8, 2020
  • Move Qt4/Qt5-dependent logic re: devicePixelRatio to qt_compat;
    these functions are documented to have existed ever since Qt5 was
    released.
  • In Toolbar, no need to set .canvas (the base class init does it)
    or ._parent (one can just return the canvas' .parent());
    .basedir is just a small helper which doesn't exist in other
    backends and doesn't warrant being public.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.3.0 milestone Apr 8, 2020
QtWidgets.QToolBar.__init__(self, parent)
NavigationToolbar2.__init__(self, canvas)

@cbook.deprecated("3.3", alternative="self.canvas.parent()")
@property
def parent(self):
return self._parent
return self.canvas.parent()
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is correct, is it actually guaranteed that the toolbar and the canvas share the same Qt parent?

Copy link
Member
@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

I have some slight concerns about the parent related changes, slight preference they get moved to a different PR.

- Move Qt4/Qt5-dependent logic re: devicePixelRatio to qt_compat;
  these functions are documented to have existed ever since Qt5 was
  released.
- In Toolbar, no need to set `.canvas` (the base class init does it)
  or `._parent` (one can just return the canvas' `.parent()`);
  `.basedir` is just a small helper which doesn't exist in other
  backends and doesn't warrant being public.
@anntzer
Copy link
Contributor Author
anntzer commented Apr 8, 2020

I reverted that specific change -- I have some further plans for cleanup, but that specific point doesn't matter.

@timhoffm timhoffm merged commit 0ba2b40 into matplotlib:master Apr 12, 2020
@anntzer anntzer deleted the qtclean branch April 12, 2020 23:18
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
0