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

macOS native dialogs don't support setting directory #28

Open
altendky opened this issue Jun 23, 2020 · 0 comments
Open

macOS native dialogs don't support setting directory #28

altendky opened this issue Jun 23, 2020 · 0 comments

Comments

@altendky
Copy link
Owner

Need to report this to Qt. Non-native dialog works.

1197:preqtrio administrator$ venv/bin/python x.py
/Users/administrator/preqtrio/blue

image

import os
import pathlib

from PyQt5 import QtWidgets

p = (pathlib.Path('blue') / 'red').resolve()
parent = p.parent
parent.mkdir(parents=True, exist_ok=True)

app = QtWidgets.QApplication([])
if not parent.is_dir():
    raise Exception('parent is not a directory')
s = os.fspath(parent)
print(s)
dialog = QtWidgets.QFileDialog(directory=s)
dialog.selectFile(os.fspath(p))
dialog.show()
app.exec_()
altendky added a commit that referenced this issue Jun 23, 2020
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

1 participant