Skip to content
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

fix default image format in gtk4 savefig dialog #27716

Merged
merged 1 commit into from Jan 30, 2024

Conversation

ahaldane
Copy link
Contributor

@ahaldane ahaldane commented Jan 29, 2024

PR summary

When I try to save a figure using the gtk4 file chooser the default format is PGF code for LaTeX, but it should be "png" because I set rcParams["savefig.format"] = 'png' . The default file extension is still .png , confusingly. This only started happening after I recently upgraded my system to gtk4.

Looking at the code, I see an indexing bug when choosing the default format: The previous lines to my diff reorganized the format order so that the default format is the first in the list, therefore to get the default one should use index 0, not the old index before reordering.

PR checklist

I manually tested that the dialog works as expected after this PR. I did not run the unit tests, nor create a unit test, but I can run them if requested. I hope that CI can be enough for such a small change as I haven't set up a dev env for matplotlib.

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.

Good catch! I presume there isn't an easy way to add a test for this?

@dstansby dstansby added this to the v3.8.3 milestone Jan 30, 2024
@QuLogic
Copy link
Member

QuLogic commented Jan 30, 2024

Unfortunately, there is no way to automate GUI tests like these.

@QuLogic QuLogic merged commit 2d2b113 into matplotlib:main Jan 30, 2024
35 of 41 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 30, 2024
QuLogic added a commit that referenced this pull request Feb 1, 2024
…716-on-v3.8.x

Backport PR #27716 on branch v3.8.x (fix default image format in gtk4 savefig dialog)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants