Skip to content

Add compatibility layer for keywords arguments of QFileDialog get* class methods #432

@Czaki

Description

@Czaki

The QfileDialog class contains few static methods for fast opening files: https://doc.qt.io/qt-6/qfiledialog.html#static-public-members

Unfortunately, PyQt and PySide backends differ in the naming argument that provides default directory.
In PyQt5/6 it is named directory, when in PySide2/6 it is named dir. PySide follows original Qt convention where PqYt decided to not use the keyword as name of an argument.

Unfortunately, I do not know the method of testing that could find this problem. AS calling this function opened dialogs that hang tests, and with mocking the problem with the signature is not triggered.

Are you open for PR that will introduce cross-compatibility layer.

Something like:

if "dir" in kwargs:
    kwargs["directory"] = kwargs.pop("dir")

and vice versa?

inspired by discussion from napari/napari#5834

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions