diff -r a7cbf3d61498 -r 3c605ab5a8c7 src/eric7/EricWidgets/EricDirFileDialog.py --- a/src/eric7/EricWidgets/EricDirFileDialog.py Sat Jul 16 18:14:30 2022 +0200 +++ b/src/eric7/EricWidgets/EricDirFileDialog.py Sun Jul 17 12:21:39 2022 +0200 @@ -7,6 +7,8 @@ Module implementing a dialog to select files and directories simultaneously. """ +import pathlib + from PyQt6.QtCore import pyqtSlot, QItemSelection from PyQt6.QtGui import QFileSystemModel from PyQt6.QtWidgets import QFileDialog, QPushButton, QLineEdit, QTreeView @@ -143,3 +145,32 @@ dlg.exec() return dlg.__selectedFilesFolders + + @staticmethod + def getOpenFileAndDirPaths( + parent=None, caption="", directory="", filterStr="", options=None + ): + """ + Static method to get the paths of files and directories for opening it. + + @param parent parent widget of the dialog + @type QWidget + @param caption window title of the dialog + @type str + @param directory working directory of the dialog + @type str or pathlib.Path + @param filterStr filter string for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return paths of the selected files and folders + @rtype list of pathlib.Path + """ + if options is None: + options = QFileDialog.Option(0) + options |= QFileDialog.Option.DontUseNativeDialog + dlg = EricDirFileDialog(parent, caption, str(directory), filterStr) + dlg.setOptions(options) + dlg.exec() + + return [pathlib.Path(p) for p in dlg.__selectedFilesFolders]