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

Work Files: QFileDialog.getOpenFileName in PyQt5 uses directory instead of dir #408

Open
jasperges opened this issue Aug 2, 2019 · 6 comments

Comments

@jasperges
Copy link
Contributor

When using PyQt5 the Work Files app crashes on on_browse_pressed, because it uses directory instead of dir for QFileDialog.getOpenFileName (see here).

The best option IMHO would be to address this in Qt (see this issue). But that would require some more work as most members of QFileDialog are affected.
As a temporary solution I use if Qt.IsPyQt5: ... in my personal branch. Should we add this 'fix' in workfiles/app.py or wait for this to be addresses in Qt and update Qt in vendor?

@BigRoy
Copy link
Collaborator

BigRoy commented Aug 2, 2019

I can't find that change in the Qt documentation anywhere, as mentioned. How about just passing it as a regular argument as opposed to keyword argument?

        work_file = QtWidgets.QFileDialog.getOpenFileName(
            None,          # parent,
            "Work Files",  # caption
            self.root,     # dir | directory
            filter=filter
        )[0]

@jasperges
Copy link
Contributor Author

jasperges commented Aug 2, 2019

Here you can find the documentation. Although everything is still 'TODO'...
I'm not a big fan of not using keyword arguments, but your solution should work fine.

@BigRoy
Copy link
Collaborator

BigRoy commented Aug 2, 2019

I'm not a big fan of not using keyword arguments,

Agreed, rather explicit as opposed to implicit.

If it has been directory consistenly across PySide2 / PyQt5 versions I guess we should just end up matching it and make sure Qt.py is updated for Avalon with the fix.

@jasperges
Copy link
Contributor Author

As far as I can tell PyQt5 uses directory everywhere, where PySide2 (and also PyQt4) use dir.

@BigRoy
Copy link
Collaborator

BigRoy commented Dec 14, 2019

@jasperges Are we able to resolve this by now? Or has it already been solved? :)

@jasperges
Copy link
Contributor Author

jasperges commented Dec 16, 2019

@BigRoy The issue is still there. But your proposed solution works fine. Actually I'm moving to PySide2 now, mainly to be in line with other DCC's. Maya, Nuke, Houdini etc. use PySide2 right?

BigRoy pushed a commit to BigRoy/core that referenced this issue Jan 25, 2022
lsattrs: Fix Py3 compatibility for Maya 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants