Tasks

class lib.gui.project.Tasks(config: Config, file_handler: type[FileHandler])

Bases: _GuiSession

Faceswap .fst Task File handling.

Faceswap tasks handle the management of each individual task tab in the GUI. Unlike Projects, Tasks contains all the active tasks currently running, rather than an individual task.

Parameters:
  • config (Config) – The master GUI config

  • file_handler (type[FileHandler]) – A file handler object

Methods Summary

add_project_task(filename, command, options)

Add an individual task from a loaded Project to the internal _tasks dict.

clear()

Reset all GUI options to their default values for the active tab.

clear_tasks()

Clears all of the stored tasks.

load(*args[, filename, current_tab])

Load a task into this Tasks class.

reload()

Reset currently selected tab GUI options to their last saved state.

save([save_as])

Save the current GUI state for the active tab to a .fst faceswap task file.

Methods Documentation

add_project_task(filename: str, command: str, options: dict[str, str | dict[str, bool | int | float | str]]) None

Add an individual task from a loaded Project to the internal _tasks dict.

Project tasks take priority over any other tasks, so the individual tasks from a new project must be placed in the _tasks dict.

Parameters:
  • filename (str) – The filename of the session project file

  • command (str) – The tab that this task’s options belong to

  • options (dict[str, str | dict[str, bool | int | float | str]]) – The options for this task loaded from the project

Return type:

None

clear() None

Reset all GUI options to their default values for the active tab.

Return type:

None

clear_tasks() None

Clears all of the stored tasks.

This is required when loading a task stored in a legacy project file, and is only to be called by Project when a project has been loaded which is in fact a task.

Return type:

None

load(*args, filename: str | None = None, current_tab: bool = True) None

Load a task into this Tasks class.

Tasks can be loaded from project .fsw files or task .fst files, depending on where this function is being called from.

Parameters:
  • *args – Unused, but needs to be present for arguments passed by tkinter event handling

  • filename (str | None) – If a filename is passed in, This will be used, otherwise a file handler will be launched to select the relevant file.

  • current_tab (bool) – True if the task to be loaded must be for the currently selected tab. False if loading a task into any tab. If current_tab is True then tasks can be loaded from .fsw and .fst files, otherwise they can only be loaded from .fst files. Default: True

Return type:

None

reload() None

Reset currently selected tab GUI options to their last saved state.

Return type:

None

save(save_as: bool = False) None

Save the current GUI state for the active tab to a .fst faceswap task file.

Parameters:

save_as (bool) – Whether to save to the stored filename, or pop open a file handler to ask for a location. If there is no stored filename, then a file handler will automatically be popped. Default: False

Return type:

None

add_project_task(filename: str, command: str, options: dict[str, str | dict[str, bool | int | float | str]]) None

Add an individual task from a loaded Project to the internal _tasks dict.

Project tasks take priority over any other tasks, so the individual tasks from a new project must be placed in the _tasks dict.

Parameters:
  • filename (str) – The filename of the session project file

  • command (str) – The tab that this task’s options belong to

  • options (dict[str, str | dict[str, bool | int | float | str]]) – The options for this task loaded from the project

Return type:

None

clear() None

Reset all GUI options to their default values for the active tab.

Return type:

None

clear_tasks() None

Clears all of the stored tasks.

This is required when loading a task stored in a legacy project file, and is only to be called by Project when a project has been loaded which is in fact a task.

Return type:

None

load(*args, filename: str | None = None, current_tab: bool = True) None

Load a task into this Tasks class.

Tasks can be loaded from project .fsw files or task .fst files, depending on where this function is being called from.

Parameters:
  • *args – Unused, but needs to be present for arguments passed by tkinter event handling

  • filename (str | None) – If a filename is passed in, This will be used, otherwise a file handler will be launched to select the relevant file.

  • current_tab (bool) – True if the task to be loaded must be for the currently selected tab. False if loading a task into any tab. If current_tab is True then tasks can be loaded from .fsw and .fst files, otherwise they can only be loaded from .fst files. Default: True

Return type:

None

reload() None

Reset currently selected tab GUI options to their last saved state.

Return type:

None

save(save_as: bool = False) None

Save the current GUI state for the active tab to a .fst faceswap task file.

Parameters:

save_as (bool) – Whether to save to the stored filename, or pop open a file handler to ask for a location. If there is no stored filename, then a file handler will automatically be popped. Default: False

Return type:

None