13 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, QButtonGroup |
13 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, QButtonGroup |
14 |
14 |
15 from EricWidgets.EricCompleters import EricFileCompleter, EricDirCompleter |
15 from EricWidgets.EricCompleters import EricFileCompleter, EricDirCompleter |
16 |
16 |
17 from .Ui_FileDialogWizardDialog import Ui_FileDialogWizardDialog |
17 from .Ui_FileDialogWizardDialog import Ui_FileDialogWizardDialog |
18 |
|
19 import Globals |
|
20 |
18 |
21 |
19 |
22 class FileDialogWizardDialog(QDialog, Ui_FileDialogWizardDialog): |
20 class FileDialogWizardDialog(QDialog, Ui_FileDialogWizardDialog): |
23 """ |
21 """ |
24 Class implementing the color dialog wizard dialog. |
22 Class implementing the color dialog wizard dialog. |
111 self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole |
109 self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole |
112 ) |
110 ) |
113 |
111 |
114 msh = self.minimumSizeHint() |
112 msh = self.minimumSizeHint() |
115 self.resize(max(self.width(), msh.width()), msh.height()) |
113 self.resize(max(self.width(), msh.width()), msh.height()) |
116 |
|
117 def __adjustOptions(self, options): |
|
118 """ |
|
119 Private method to adjust the file dialog options. |
|
120 |
|
121 @param options file dialog options (QFileDialog.Option) |
|
122 @return modified options (QFileDialog.Option) |
|
123 """ |
|
124 if Globals.isLinuxPlatform(): |
|
125 options |= QFileDialog.Option.DontUseNativeDialog |
|
126 return options |
|
127 |
114 |
128 @pyqtSlot(int) |
115 @pyqtSlot(int) |
129 def on_pyqtComboBox_currentIndexChanged(self, index): |
116 def on_pyqtComboBox_currentIndexChanged(self, index): |
130 """ |
117 """ |
131 Private slot to setup the dialog for the selected PyQt variant. |
118 Private slot to setup the dialog for the selected PyQt variant. |
191 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked(): |
178 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked(): |
192 if not self.cSymlinks.isChecked(): |
179 if not self.cSymlinks.isChecked(): |
193 options = QFileDialog.Option.DontResolveSymlinks |
180 options = QFileDialog.Option.DontResolveSymlinks |
194 else: |
181 else: |
195 options = QFileDialog.Option(0) |
182 options = QFileDialog.Option(0) |
196 options = self.__adjustOptions(options) |
|
197 QFileDialog.getOpenFileName( |
183 QFileDialog.getOpenFileName( |
198 None, |
184 None, |
199 self.eCaption.text(), |
185 self.eCaption.text(), |
200 self.eStartWith.text(), |
186 self.eStartWith.text(), |
201 self.eFilters.text(), |
187 self.eFilters.text(), |
205 elif self.rOpenFileUrl.isChecked(): |
191 elif self.rOpenFileUrl.isChecked(): |
206 if not self.cSymlinks.isChecked(): |
192 if not self.cSymlinks.isChecked(): |
207 options = QFileDialog.Option.DontResolveSymlinks |
193 options = QFileDialog.Option.DontResolveSymlinks |
208 else: |
194 else: |
209 options = QFileDialog.Option(0) |
195 options = QFileDialog.Option(0) |
210 options = self.__adjustOptions(options) |
|
211 QFileDialog.getOpenFileUrl( |
196 QFileDialog.getOpenFileUrl( |
212 None, |
197 None, |
213 self.eCaption.text(), |
198 self.eCaption.text(), |
214 QUrl(self.eStartWith.text()), |
199 QUrl(self.eStartWith.text()), |
215 self.eFilters.text(), |
200 self.eFilters.text(), |
220 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked(): |
205 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked(): |
221 if not self.cSymlinks.isChecked(): |
206 if not self.cSymlinks.isChecked(): |
222 options = QFileDialog.Option.DontResolveSymlinks |
207 options = QFileDialog.Option.DontResolveSymlinks |
223 else: |
208 else: |
224 options = QFileDialog.Option(0) |
209 options = QFileDialog.Option(0) |
225 options = self.__adjustOptions(options) |
|
226 QFileDialog.getOpenFileNames( |
210 QFileDialog.getOpenFileNames( |
227 None, |
211 None, |
228 self.eCaption.text(), |
212 self.eCaption.text(), |
229 self.eStartWith.text(), |
213 self.eStartWith.text(), |
230 self.eFilters.text(), |
214 self.eFilters.text(), |
234 elif self.rOpenFileUrls.isChecked(): |
218 elif self.rOpenFileUrls.isChecked(): |
235 if not self.cSymlinks.isChecked(): |
219 if not self.cSymlinks.isChecked(): |
236 options = QFileDialog.Option.DontResolveSymlinks |
220 options = QFileDialog.Option.DontResolveSymlinks |
237 else: |
221 else: |
238 options = QFileDialog.Option(0) |
222 options = QFileDialog.Option(0) |
239 options = self.__adjustOptions(options) |
|
240 QFileDialog.getOpenFileUrls( |
223 QFileDialog.getOpenFileUrls( |
241 None, |
224 None, |
242 self.eCaption.text(), |
225 self.eCaption.text(), |
243 QUrl(self.eStartWith.text()), |
226 QUrl(self.eStartWith.text()), |
244 self.eFilters.text(), |
227 self.eFilters.text(), |
249 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked(): |
232 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked(): |
250 if not self.cSymlinks.isChecked(): |
233 if not self.cSymlinks.isChecked(): |
251 options = QFileDialog.Option.DontResolveSymlinks |
234 options = QFileDialog.Option.DontResolveSymlinks |
252 else: |
235 else: |
253 options = QFileDialog.Option(0) |
236 options = QFileDialog.Option(0) |
254 options = self.__adjustOptions(options) |
|
255 QFileDialog.getSaveFileName( |
237 QFileDialog.getSaveFileName( |
256 None, |
238 None, |
257 self.eCaption.text(), |
239 self.eCaption.text(), |
258 self.eStartWith.text(), |
240 self.eStartWith.text(), |
259 self.eFilters.text(), |
241 self.eFilters.text(), |
263 elif self.rSaveFileUrl.isChecked(): |
245 elif self.rSaveFileUrl.isChecked(): |
264 if not self.cSymlinks.isChecked(): |
246 if not self.cSymlinks.isChecked(): |
265 options = QFileDialog.Option.DontResolveSymlinks |
247 options = QFileDialog.Option.DontResolveSymlinks |
266 else: |
248 else: |
267 options = QFileDialog.Option(0) |
249 options = QFileDialog.Option(0) |
268 options = self.__adjustOptions(options) |
|
269 QFileDialog.getSaveFileUrl( |
250 QFileDialog.getSaveFileUrl( |
270 None, |
251 None, |
271 self.eCaption.text(), |
252 self.eCaption.text(), |
272 QUrl(self.eStartWith.text()), |
253 QUrl(self.eStartWith.text()), |
273 self.eFilters.text(), |
254 self.eFilters.text(), |
281 options |= QFileDialog.Option.DontResolveSymlinks |
262 options |= QFileDialog.Option.DontResolveSymlinks |
282 if self.cDirOnly.isChecked(): |
263 if self.cDirOnly.isChecked(): |
283 options |= QFileDialog.Option.ShowDirsOnly |
264 options |= QFileDialog.Option.ShowDirsOnly |
284 else: |
265 else: |
285 options |= QFileDialog.Option(0) |
266 options |= QFileDialog.Option(0) |
286 options = self.__adjustOptions(options) |
|
287 QFileDialog.getExistingDirectory( |
267 QFileDialog.getExistingDirectory( |
288 None, self.eCaption.text(), self.eWorkDir.text(), options |
268 None, self.eCaption.text(), self.eWorkDir.text(), options |
289 ) |
269 ) |
290 elif self.rDirectoryUrl.isChecked(): |
270 elif self.rDirectoryUrl.isChecked(): |
291 options = QFileDialog.Option(0) |
271 options = QFileDialog.Option(0) |
293 options |= QFileDialog.Option.DontResolveSymlinks |
273 options |= QFileDialog.Option.DontResolveSymlinks |
294 if self.cDirOnly.isChecked(): |
274 if self.cDirOnly.isChecked(): |
295 options |= QFileDialog.Option.ShowDirsOnly |
275 options |= QFileDialog.Option.ShowDirsOnly |
296 else: |
276 else: |
297 options |= QFileDialog.Option(0) |
277 options |= QFileDialog.Option(0) |
298 options = self.__adjustOptions(options) |
|
299 QFileDialog.getExistingDirectoryUrl( |
278 QFileDialog.getExistingDirectoryUrl( |
300 None, |
279 None, |
301 self.eCaption.text(), |
280 self.eCaption.text(), |
302 QUrl(self.eWorkDir.text()), |
281 QUrl(self.eWorkDir.text()), |
303 options, |
282 options, |