Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Describe FigureManager #14106

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

Conversation

timhoffm
Copy link
Member

PR Summary

Describe the FigureManagerBase class. While I think "manager" really a bad term here, we're stuck with it. So at least describe what it's about.

Note: Im quite unclear on the role of the FigureManager concerning the event stuff, therefore I've kept that part really vague. If somebody has a better description commits are welcome. Otherwise, this is at least a lot better than the current documentation.


**Key and mouse button press handling**

The manager allows to process matplotlib `.Event`\s.
Copy link
Member

Choose a reason for hiding this comment

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

The thing the FigureManagerBase does in relation to key events is to hook up the default key_press_handler to the Canvas (which is what handles the bridge from the GUI event system to our internal system).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Is that something a user would in any way interact with (like set_window_title()) or is that just a technical aspect that is not relevant to the user. In particular, will the user call key_press() under any circumstances?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe for testing or in some edge-cases, but I would not expect it in normal course of operation.

I suspect the reason key_press is a method is so that sub-classes could over-ride exactly what it did without having to handle the mpl_connect call and bookkeeping (but we don't actually do that internally).

@tacaswell tacaswell added this to the v3.2.0 milestone Apr 30, 2019
@timhoffm timhoffm force-pushed the doc-figuremanager branch 2 times, most recently from d33e884 to f5512a2 Compare April 30, 2019 16:37
Subclasses will have additional attributes and functions to access
additional functionality. This is of course backend-specific. For example,
most GUI backends have ``window`` and ``toolbar`` attributes that give
access to the native GUI widgets of the respective framework.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should either standardize or deprecate these attributes...

Copy link
Member Author

Choose a reason for hiding this comment

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

TL;DR I prefer to just document the current state within this PR. Any API changes should be discussed separately.

Can we standardize of deprecate either way? I think they are the only (easy) way to access the window and toolbar; so deprecating is not an option. OTOH, not all backends have these, e.g. FigureManagerMac does not have a window - well we could set them to None if not available.

Since the manager is actually a slightly broader concept, I'm not sure if this functionality should be in the base class - Well it's sort of already past that point having FigureManagerBase.set_window_title. One possibility would be to introduce a FigureWindowManager in between, that introduces this functionality. Also, when changing the API, I would like to think about how support a tabbed window #2194 within this framework.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, that was intended as a side discussion, not to block this PR.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

👍 overall, I've added some copy-editing suggested changes.

@timhoffm
Copy link
Member Author

@dstansby Thanks. Comments applied.

@timhoffm
Copy link
Member Author

ping @dstansby

@timhoffm timhoffm force-pushed the doc-figuremanager branch from 0af9c23 to 6d571b1 Compare July 22, 2019 21:44
@timhoffm timhoffm force-pushed the doc-figuremanager branch from 6d571b1 to c1e3fd4 Compare July 22, 2019 22:31
@timhoffm timhoffm dismissed dstansby’s stale review August 11, 2019 12:34

Comments addressed.

@ImportanceOfBeingErnest ImportanceOfBeingErnest merged commit 98948aa into matplotlib:master Aug 11, 2019
@timhoffm timhoffm deleted the doc-figuremanager branch August 11, 2019 12:49
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.

6 participants