Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: by-pass creating a local class if backend has a Backend class#22380

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

tacaswell
Copy link
Member

PR Summary

Simplify using a backend that has a backend class. I think this is the next step down the path@anntzer started us on.

There is analogous code in mpl-gui athttps://github.com/tacaswell/mpl-gui/blob/bc0cdc7bd58095039f124516cd6ca88611509513/mpl_gui/_manage_backend.py#L87-L109 .

It may be worth holding this PR until we sort out if there is anything else we want to hoist upstream from mpl_gui.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

This is implicitly tested, but might be worth pushing in some explicit tests of when the local backend does or does not get created.

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@anntzer
Copy link
Contributor

anntzer commentedFeb 3, 2022
edited
Loading

I guess we need to standardize on a name there, effectively saying "a module with a Foo global is a backend". I'm fine with calling that Backend, I just want to make sure we agree on the name.

OTOH, another approach (#18854) would be to move "everything" to the FigureCanvas class ("a module with a FigureCanvas global is a backend"). (Note, in particular, that this allows reusing the already preexisting inheritance relationship that exists between canvases.) Perhaps you can comment on that PR?

@tacaswell
Copy link
MemberAuthor

I like#18854 a lot better. It gives you a path to fromjust a Figure walk your way up to building it a sibling in whatever scheme of canvas / manager / show / etc the user has put together.

I had thought about attaching the Backend object toFigureCanvas an friends, but then you can not re-use the classes between backends. Going the otherway and putting all of the parts on theFigureCanvas means with minimal sub-classing you can associate a custom manager to a givenFigureCanvas.

Thinking a bit more about the toolbar discussion, I think having down-stream sub-class either the Manger or Toolbar classes is not a terrible pattern to suggest. We tend to think in terms of libraries and compos-ability (which makes sense given our interest in working at the library level!), but the cases where I have seen where there is significant toolbar customization have been domain specific applications (the buttons the added only made sense in avery narrow science context) where the lack of being able to compose with another packages modifications does not matter.

Closing in favor of#18854 where (as normal)@anntzer is a few steps ahead of me.

@tacaswelltacaswell modified the milestones:v3.7.0,unassignedFeb 3, 2022
@tacaswelltacaswell deleted the enh_backend_classes branchFebruary 3, 2022 18:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@tacaswell@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp