5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to enter a file system path using a file picker. |
7 Module implementing a dialog to enter a file system path using a file picker. |
8 """ |
8 """ |
9 |
9 |
|
10 from PyQt6.QtCore import QCoreApplication |
10 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout |
11 |
12 |
12 from .EricPathPicker import EricPathPicker, EricPathPickerModes |
13 from .EricPathPicker import EricPathPicker, EricPathPickerModes |
13 |
14 |
14 |
15 |
167 @type bool (optional) |
168 @type bool (optional) |
168 @return tuple containing the entered path and a flag indicating that the |
169 @return tuple containing the entered path and a flag indicating that the |
169 user pressed the OK button |
170 user pressed the OK button |
170 @rtype tuple of (str, bool) |
171 @rtype tuple of (str, bool) |
171 """ |
172 """ |
|
173 if parent is None: |
|
174 parent = QCoreApplication.instance().getMainWindow() |
|
175 |
172 # step 1: setup of the dialog |
176 # step 1: setup of the dialog |
173 dlg = EricPathPickerDialog(parent) |
177 dlg = EricPathPickerDialog(parent) |
174 if title: |
178 if title: |
175 dlg.setTitle(title) |
179 dlg.setTitle(title) |
176 if label: |
180 if label: |
225 @type list of str (optional) |
229 @type list of str (optional) |
226 @return tuple containing the entered path and a flag indicating that the |
230 @return tuple containing the entered path and a flag indicating that the |
227 user pressed the OK button |
231 user pressed the OK button |
228 @rtype tuple of (pathlib.Path, bool) |
232 @rtype tuple of (pathlib.Path, bool) |
229 """ |
233 """ |
|
234 if parent is None: |
|
235 parent = QCoreApplication.instance().getMainWindow() |
|
236 |
230 # step 1: setup of the dialog |
237 # step 1: setup of the dialog |
231 dlg = EricPathPickerDialog(parent) |
238 dlg = EricPathPickerDialog(parent) |
232 if title: |
239 if title: |
233 dlg.setTitle(title) |
240 dlg.setTitle(title) |
234 if label: |
241 if label: |