DirOrFilesFullPaths

class lib.cli.actions.DirOrFilesFullPaths(*args, filetypes: str | None = None, **kwargs)

Bases: FileFullPaths

Adds support to the GUI to launch either a file browser for selecting multiple files or a folder browser.

Some inputs (for example face filter) can come from a folder of images or from multiple image file. This indicates to the GUI that it should place 2 buttons (one for a folder browser, one for a multi-file browser) for file/folder browsing.

The standard argparse.Action is extended with the additional parameter filetypes, indicating to the GUI that it should pop a file browser, and limit the results to the file types listed. As well as the standard parameters, the following parameter is required:

Parameters:

filetypes (str) – The accepted file types for this option. This is the key for the GUIs lookup table which can be found in lib.gui.utils.FileHandler. NB: This parameter is only used for the file browser and not the folder browser

Example

>>> argument_list = []
>>> argument_list.append(dict(
>>>        opts=("-f", "--input_frames"),
>>>        action=DirOrFileFullPaths,
>>>        filetypes="video))"

Methods Summary

__call__(parser, namespace, values[, ...])

Override _FullPaths __call__ function.

format_usage()

Methods Documentation

__call__(parser, namespace, values, option_string=None) None

Override _FullPaths __call__ function.

The input for this option can be a space separated list of files or a single folder. Folders can have spaces in them, so we don’t want to blindly expand the paths.

We check whether the input can be resolved to a folder first before expanding.

Return type:

None

format_usage()
__call__(parser, namespace, values, option_string=None) None

Override _FullPaths __call__ function.

The input for this option can be a space separated list of files or a single folder. Folders can have spaces in them, so we don’t want to blindly expand the paths.

We check whether the input can be resolved to a folder first before expanding.

Return type:

None