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

backend_qt5 (1.4.0): Not saving the figure with NavigationToolbar (solved) #3454

Closed
getzze opened this issue Sep 2, 2014 · 6 comments
Closed

Comments

@getzze
Copy link

getzze commented Sep 2, 2014

Bug also reported here: https://bugs.archlinux.org/task/41790
When clicking on the Save button on the NavigationToolbar, I get an error:
Format "png)')" is not supported. Supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff.

I tracked the bug to be coming from the output of the _getSaveFileName function, that is supposed to be a string but is a tuple in reality. In qt_compat.py, _getSaveFileName links to QtWidgets.QtFileDialog.getSaveFileName.
In pyqt4, this function returns a string, but the doc pyqt4/5 differences says that in pyqt5 the functions returns a tuple (filename, extension), as for getSaveFileNameAndFilter in pyqt4.

Commenting line 96 in qt_compat.py solved the problem, because _getSaveFileName is then correctly defined in line 117 (only returning the first element of the tuple).

@tacaswell tacaswell added this to the v1.4.x milestone Sep 2, 2014
@tacaswell
Copy link
Member

@mfitzp can you take a look at this? (Let me know if I should stop pestering you with these issues).

@getzze
Copy link
Author

getzze commented Sep 2, 2014

Also, I realized that some classes (at least one) have changed between QtCore and QtGui (QtWidgets mainly in pyqt5) in the 4->5 transition. For instance, QSortFilterProxyModel is in QtGui in PyQt4 and in QtCore in PyQt5... Then there may be some unpredicted problems with the shim at the end of qt_compat.py

@mfitzp
Copy link
Member

mfitzp commented Sep 2, 2014

@tacaswell I'm happy to have a look, I have a drop-in wrapper for getSaveFileName that should fix this bug. Happy to keep looking at these issues, but I am currently writing up a PhD and moving to the Netherlands (11 days!) so may be a bit of lag.

@getzze The qt_compat only aims to shim the things that are actually used in the Qt backend. It would be nice to have a complete API compatibility layer - not least because of duplications of effort applying similar compatibility layers in other projects - but it's a big task. If you're interested we could have a go?

@tacaswell
Copy link
Member

@mfitzp Good luck!

@mfitzp
Copy link
Member

mfitzp commented Sep 4, 2014

The opened PR #3469 should fix this. It updates all APIs to present a PyQt5/PySide like interface returning a tuple and then handles this in the backend.

@tacaswell
Copy link
Member

Closed by #3469 which is on this branch as fe125ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants