-
Notifications
You must be signed in to change notification settings - Fork 5
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
Doc/rewrite (and code changes inspired by trying to document it) #17
Conversation
Use the top level one still, no need to put it in multiple places
We are not using it.
docs/source/index.rst
Outdated
|
||
mg.show([fig1, fig2]) | ||
import mpl_gui.registry as reg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reg
may need some consideration, as this will be the start of a "best practices". I appreciate this is registry, but I wonder if end users will think of it that way, versus a list of GUI windows? If the import were something like mwindows
then the below would read mwindows.show()
which makes more sense to me than registry.show
. But maybe "windows" isn't the right idea either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree! As with #16 I think almost all of these names are up for debate.
Possible "short" versions (and we can change the module name to be something consistent):
The other red-flag is that I got my self confused that |
1159424
to
be5c52e
Compare
Having a conversation about this it was impossible to keep straight with the two meanings of `show`. closes matplotlib#16
be5c52e
to
fecb3c0
Compare
Should the module currently known as |
OK, I guess the use here is to mimic
I almost wish this were |
Because if the global state lives at the top-level there is no way to opt out of it! By putting it in a submodule users who do not want the global state to be around can either not import it or put |
Sure, but... is that really a problem? If they don't want to use it, they don't have to - it's just an empty registry object at that point. I guess if this goes in mpl proper it could be a side module instead of a sub module. |
We have a number of issues due to users using the global state without realizing it. I started down this project with the goal of getting rid of global state and only added it back reluctantly (mostly to prove we could re-implement pyplot-like on top of this). If the net result is to replace on unavoidable bit of global with another bit of global state it is not clear to me that there is actually any upside of the code churn. If (when?) we pull this in to the main repo I think we would need |
I took @rcomer 's suggestion and put "global" in the name. |
OK, I guess if it makes it into main, it could be |
... thought now that I think about it, I forget why we need a registry at all. The original suggestion was to just make |
We need it for the pyplot-replacement and it seems nice to expose publicly. I think it would be a nice pattern to have user plotting functions that take in a fr = FigureRegistry()
plot1(..., fr)
plot2(..., fr)
fr.show() I made the helper functions at the top level private, but could easily be convinced to put them back. Writing the docs, it felt like I had 3 copies of exactly the same code block and "fixed" it by making one different. |
I'm still confused by this - happy to sidebar about it if easier... Of course we need to keep Previously you were offering
What is the advantage of that over just allowing such libraries to continue to use pyplot? Better is surely |
We were more aggressively cleaning up the Figure via the 'q' hot key than via closing via Window Manager UI.
Going to go ahead and merge this (to get built docs) and continue in a new PR. |
Re-wrote the docs to include
mpl_gui.registry
.