getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
218 stars 48 forks source link

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

Open jasperges opened 5 years ago

jasperges commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

BigRoy commented 4 years ago

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

jasperges commented 4 years ago

@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?