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 import os |
10 import os |
11 |
11 |
|
12 from PyQt6.QtCore import QCoreApplication |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QLineEdit, QVBoxLayout |
13 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QLineEdit, QVBoxLayout |
13 |
14 |
14 from .EricPathPicker import EricPathPicker, EricPathPickerModes |
15 from .EricPathPicker import EricPathPicker, EricPathPickerModes |
15 |
16 |
16 |
17 |
142 @type QWidget |
143 @type QWidget |
143 @return tuple containing the selected action (cancel, rename, |
144 @return tuple containing the selected action (cancel, rename, |
144 overwrite) and the filename (in case of 'rename' or 'overwrite') |
145 overwrite) and the filename (in case of 'rename' or 'overwrite') |
145 @rtype tuple of (str, str) |
146 @rtype tuple of (str, str) |
146 """ |
147 """ |
|
148 if parent is None: |
|
149 parent = QCoreApplication.instance().getMainWindow() |
|
150 |
147 dlg = EricFileSaveConfirmDialog( |
151 dlg = EricFileSaveConfirmDialog( |
148 filename, title, message=message, picker=picker, parent=parent |
152 filename, title, message=message, picker=picker, parent=parent |
149 ) |
153 ) |
150 dlg.exec() |
154 dlg.exec() |
151 return dlg.selectedAction() |
155 return dlg.selectedAction() |