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

Return filename from save_figure#27766

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

Merged
timhoffm merged 21 commits intomatplotlib:mainfromZybulon:main
Oct 28, 2024
Merged

Conversation

Zybulon
Copy link
Contributor

@ZybulonZybulon commentedFeb 10, 2024
edited
Loading

Closes#27744

PR summary

This PR adresses issue#27744.
save_figure functions from the NavigationToolbar return the filename of the saved figure.
If no figure is save then it returns None.
For GTK4 backend and Web backend I could not get the filename so the function still returns None.

PR checklist

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

Zybulon reacted with thumbs up emoji
@ZybulonZybulonforce-pushed themain branch 5 times, most recently from62fe3f4 to1ec4655CompareFebruary 10, 2024 15:19
@ZybulonZybulon marked this pull request as ready for reviewFebruary 10, 2024 16:16
@tacaswelltacaswell added this to thev3.9.0 milestoneFeb 10, 2024
@tacaswell
Copy link
Member

We can probably use a closure /nonlocal with the gtk response callback, but I'm not sure ifdialog.show() blocks until the window is closed or return immediately. If it blocks then we can get the the filename out of that one too.

I agree we the webagg one looks like a big lift because I don't think we currently have a response back over the websocket. Even if we added that, it is not super clear it would be useful as the filesystems that the client (in a browser possibly on a different machine) is in general not the filesystem that the server sees. There is also a good case we shouldnot leak anything about the client file system back to the server.

@tacaswell
Copy link
Member

If we want to differentiate between "I did not save a file" and "I can not tell you if a file was saved" we could return a different sentinel in the "I did not save a file case". The simplest thing (from an implement ion point of view...typing this proposal would be hard) would be to addNO_FILE_SAVED = object() as a class attribute onNavigationToolbar2 and return that if no file is saved.

@Zybulon
Copy link
ContributorAuthor

That is a good idea. I'll do that.

@Zybulon
Copy link
ContributorAuthor

Zybulon commentedFeb 10, 2024
edited
Loading

Usually the FileDialogs (from Qt, Gtk etc...) returnNone when no file is selected. To be consistent with this behavior, I propose returningNone when no file is saved and a class attributeUNKNOWN_SAVED_STATUS = object() when the status is unknown. What do you think ?

@ZybulonZybulon marked this pull request as draftFebruary 11, 2024 09:15
@ZybulonZybulonforce-pushed themain branch 8 times, most recently fromf8a3028 toc474811CompareFebruary 11, 2024 15:52
@ZybulonZybulonforce-pushed themain branch 3 times, most recently from64b6642 to20c4e55CompareMay 20, 2024 06:59
@ZybulonZybulon marked this pull request as draftMay 20, 2024 16:22
@ZybulonZybulon marked this pull request as ready for reviewMay 20, 2024 16:23
@Zybulon
Copy link
ContributorAuthor

Hello,
Sorry for the delay. I think the pull request is ready for review when someone has time to do so.

@ZybulonZybulon marked this pull request as draftJune 29, 2024 09:42
@ZybulonZybulon marked this pull request as ready for reviewJune 29, 2024 09:42
@tacaswelltacaswell reopened thisOct 11, 2024
@tacaswell
Copy link
Member

"power-cycled" to re-trigger CI.

@QuLogic
Copy link
Member

QuLogic commentedOct 12, 2024
edited
Loading

Unfortunately, this is failing on the newly-added test.

@tacaswell
Copy link
Member

The failure is gtk setting itself up on python313:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 200201self = <matplotlib.backends.backend_gtk3.FigureManagerGTK3 object at 0x7f08a8dab770>202canvas = <backend_gtk3agg.FigureCanvasGTK3Agg object at 0x7f08a7f86c00 (matplotlib+backends+backend_gtk3agg+FigureCanvasGTK3Agg at 0x563ca08d20f0)>203num = 1204205    def __init__(self, canvas, num):206        self._gtk_ver = gtk_ver = Gtk.get_major_version()207    208        app = _create_application()209        self.window = Gtk.Window()210        app.add_window(self.window)211        super().__init__(canvas, num)212    213        if gtk_ver == 3:214>           self.window.set_wmclass("matplotlib", "Matplotlib")215E           SystemError: <slot wrapper '__getattribute__' of 'module' objects> returned a result with an exception set216217lib/matplotlib/backends/_backend_gtk.py:146: SystemError

@timhoffmtimhoffm merged commitff262a1 intomatplotlib:mainOct 28, 2024
62 of 67 checks passed
@timhoffm
Copy link
Member

Thanks@Zybulon and congratulations on your first contribution to Matplotlib. 🎉 We hope to hear from you again!

@QuLogic
Copy link
Member

The failing tests were not fixed yet...

@timhoffm
Copy link
Member

timhoffm commentedOct 29, 2024
edited
Loading

which one? I thought the gtk3 python313 issue mentioned above is unrelated - Ok, my understanding: While it is unrelated, the intoduced test exercises a new gtk3 code path, which is broken.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
v3.10.0
Development

Successfully merging this pull request may close these issues.

[ENH]: save_figure returns image fullpath
5 participants
@Zybulon@tacaswell@anntzer@timhoffm@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp