ContextFullPaths

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

Bases: FileFullPaths

Adds support for context sensitive browser dialog opening in the GUI.

For some tasks, the type of action (file load, folder open, file save etc.) can vary depending on the task to be performed (a good example of this is the effmpeg tool). Using this action indicates to the GUI that the type of dialog to be launched can change depending on another option. As well as the standard parameters, the below parameters are required. NB: nargs are explicitly disallowed.

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

  • action_option (str) – The command line option that dictates the context of the file dialog to be opened. Bespoke actions are set in lib.gui.utils.FileHandler

Example

Assuming an argument has already been set with option string -a indicating the action to be performed, the following will pop a different type of dialog depending on the action selected:

>>> argument_list = []
>>> argument_list.append(dict(
>>>        opts=("-f", "--input_video"),
>>>        action=ContextFullPaths,
>>>        filetypes="video",
>>>        action_option="-a"))

Methods Summary

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

Call self as a function.

format_usage()

Methods Documentation

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

Call self as a function.

Return type:

None

format_usage()