--- a/eric7/EricWidgets/EricFileDialog.py Sun May 30 19:03:39 2021 +0200 +++ b/eric7/EricWidgets/EricFileDialog.py Thu Jun 03 15:58:59 2021 +0200 @@ -4,8 +4,7 @@ # """ -Module implementing alternative functions for the QFileDialog static methods -to cope with distributor's usage of KDE wrapper dialogs for Qt file dialogs. +Module implementing alternative functions for the QFileDialog static methods. """ from PyQt6.QtWidgets import QFileDialog @@ -28,9 +27,12 @@ Private function to reorder the file filter to cope with a KDE issue introduced by distributor's usage of KDE file dialogs. - @param filterStr Qt file filter (string) - @param initialFilter initial filter (string) - @return the rearranged Qt file filter (string) + @param filterStr Qt file filter + @type str + @param initialFilter initial filter + @type str + @return the rearranged Qt file filter + @rtype str """ if initialFilter and not Globals.isMacPlatform(): fileFilters = filterStr.split(';;') @@ -47,12 +49,18 @@ """ Module function to get the name of a file for opening it. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return name of file to be opened (string) + @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 + @param filterStr filter string for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return name of file to be opened + @rtype str """ if options is None: options = QFileDialog.Option(0) @@ -69,13 +77,20 @@ Module function to get the name of a file for opening it and the selected file name filter. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param initialFilter initial filter for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return name of file to be opened and selected filter (string, string) + @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 + @param filterStr filter string for the dialog + @type str + @param initialFilter initial filter for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return name of file to be opened and selected filter + @rtype tuple of (str, str) """ if options is None: options = QFileDialog.Option(0) @@ -91,12 +106,18 @@ """ Module function to get a list of names of files for opening. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return list of file names to be opened (list of string) + @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 + @param filterStr filter string for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return list of file names to be opened + @rtype list of str """ if options is None: options = QFileDialog.Option(0) @@ -113,14 +134,20 @@ Module function to get a list of names of files for opening and the selected file name filter. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param initialFilter initial filter for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) + @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 + @param filterStr filter string for the dialog + @type str + @param initialFilter initial filter for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options @return list of file names to be opened and selected filter - (list of string, string) + @rtype tuple of (list of str, str) """ if options is None: options = QFileDialog.Option(0) @@ -131,17 +158,47 @@ parent, caption, directory, newfilter, initialFilter, options) +def getOpenFileAndDirNames(parent=None, caption="", directory="", + filterStr="", options=None): + """ + Module function to get the names of files and directories for opening. + + @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 + @param filterStr filter string for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return names of the selected files and folders + @rtype list of str + """ + from .EricDirFileDialog import EricDirFileDialog + return EricDirFileDialog.getOpenFileAndDirNames( + parent, caption, directory, filterStr, options + ) + + def getSaveFileName(parent=None, caption="", directory="", filterStr="", options=None): """ Module function to get the name of a file for saving it. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return name of file to be saved (string) + @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 + @param filterStr filter string for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return name of file to be saved + @rtype str """ if options is None: options = QFileDialog.Option(0) @@ -158,13 +215,20 @@ Module function to get the name of a file for saving it and the selected file name filter. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param filterStr filter string for the dialog (string) - @param initialFilter initial filter for the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return name of file to be saved and selected filter (string, string) + @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 + @param filterStr filter string for the dialog + @type str + @param initialFilter initial filter for the dialog + @type str + @param options various options for the dialog + @type QFileDialog.Options + @return name of file to be saved and selected filte + @rtype tuple of (str, str) """ if options is None: options = QFileDialog.Option(0) @@ -181,11 +245,16 @@ """ Module function to get the name of a directory. - @param parent parent widget of the dialog (QWidget) - @param caption window title of the dialog (string) - @param directory working directory of the dialog (string) - @param options various options for the dialog (QFileDialog.Options) - @return name of selected directory (string) + @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 + @param options various options for the dialog + @type QFileDialog.Options + @return name of selected directory + @rtype str """ if options is None: options = QFileDialog.Option(0)