def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename='', file_types=()): """ Create a file dialog :param dialog_type: Dialog type: open file (OPEN_DIALOG), save file (SAVE_DIALOG), open folder (OPEN_FOLDER). Default is open file. :param directory: Initial directory :param allow_multiple: Allow multiple selection. Default is false. :param save_filename: Default filename for save file dialog. :param file_types: Allowed file types in open file dialog. Should be a tuple of strings in the format: filetypes = ('Description (*.extension[;*.extension[;...]])', ...) :return: A tuple of selected files, None if cancelled. """ if type(file_types) != tuple and type(file_types) != list: raise TypeError('file_types must be a tuple of strings') for f in file_types: parse_file_type(f) if not os.path.exists(directory): directory = '' return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename, file_types)
def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename='', file_types=()): """ Create a file dialog :param dialog_type: Dialog type: open file (OPEN_DIALOG), save file (SAVE_DIALOG), open folder (OPEN_FOLDER). Default is open file. :param directory: Initial directory :param allow_multiple: Allow multiple selection. Default is false. :param save_filename: Default filename for save file dialog. :param file_types: Allowed file types in open file dialog. Should be a tuple of strings in the format: filetypes = ('Description (*.extension[;*.extension[;...]])', ...) :return: """ if type(file_types) != tuple and type(file_types) != list: raise TypeError('file_types must be a tuple of strings') for f in file_types: _parse_file_type(f) if not os.path.exists(directory): directory = '' try: _webview_ready.wait(5) assert gui.is_running() return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename, file_types) except NameError as e: raise Exception("Create a web view window first, before invoking this function") except AssertionError: raise Exception("Cannot call function: the webview has been closed")
def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename=''): if not os.path.exists(directory): directory = '' return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename)
def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename=''): """ Create a file dialog :param dialog_type: Dialog type: open file (OPEN_DIALOG), save file (SAVE_DIALOG), open folder (OPEN_FOLDER). Default is open file. :param directory: Initial directory :param allow_multiple: Allow multiple selection. Default is false. :param save_filename: Default filename for save file dialog. :return: """ if not os.path.exists(directory): directory = '' return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename)
def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename=''): """ Create a file dialog :param dialog_type: Dialog type: open file (OPEN_DIALOG), save file (SAVE_DIALOG), open folder (OPEN_FOLDER). Default is open file. :param directory: Initial directory :param allow_multiple: Allow multiple selection. Default is false. :param save_filename: Default filename for save file dialog. :return: """ if not os.path.exists(directory): directory = '' try: return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename) except NameError: raise Exception("Create a web view window first, before invoking this function")
def create_file_dialog(dialog_type=OPEN_DIALOG, directory='', allow_multiple=False, save_filename=''): """ Create a file dialog :param dialog_type: Dialog type: open file (OPEN_DIALOG), save file (SAVE_DIALOG), open folder (OPEN_FOLDER). Default is open file. :param directory: Initial directory :param allow_multiple: Allow multiple selection. Default is false. :param save_filename: Default filename for save file dialog. :return: """ if not os.path.exists(directory): directory = '' try: _webview_ready.wait(5) return gui.create_file_dialog(dialog_type, directory, allow_multiple, save_filename) except NameError as e: raise Exception("Create a web view window first, before invoking this function")
def create_file_dialog(dialog_type=OPEN_DIALOG, allow_multiple=False): return gui.create_file_dialog(dialog_type, allow_multiple)