pyface
pyface copied to clipboard
Bug report: FileDialog and DirectoryDialog raise AttributeError when closed using the "X" button
Environment
OS: Linux Python version: 3.6 Toolkit: Qt Qt API: PySide2
Description
Opening a FileDialog or DirectoryDialog and clicking "X" in the file picker that appears, generates a traceback.
Traceback (most recent call last):
File "mwe.py", line 5, in <module>
outcome = dlg.open()
File "/.../lib/python3.6/site-packages/pyface/i_dialog.py", line 168, in open
self.close()
File "/.../lib/python3.6/site-packages/pyface/ui/qt4/directory_dialog.py", line 55, in close
files = self.control.selectedFiles()
AttributeError: 'NoneType' object has no attribute 'selectedFiles'
Clicking, instead, the "Cancel" button, correctly returns CANCEL.
Steps to Reproduce
dlg = DirectoryDialog(parent=None, title="Select a folder")
outcome = dlg.open()
- run
- click "X" in the window header
-