Tasks
- class lib.gui.project.Tasks(config: Config, file_handler: type[FileHandler])
Bases:
_GuiSessionFaceswap
.fstTask 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
Projectto the internal_tasksdict.clear()Reset all GUI options to their default values for the active tab.
Clears all of the stored tasks.
load(*args[, filename, current_tab])Load a task into this
Tasksclass.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
.fstfaceswap 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
Projectto the internal_tasksdict.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
Projectwhen 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
Tasksclass.Tasks can be loaded from project
.fswfiles or task.fstfiles, 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) –
Trueif the task to be loaded must be for the currently selected tab.Falseif loading a task into any tab. If current_tab is True then tasks can be loaded from.fswand.fstfiles, otherwise they can only be loaded from.fstfiles. 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
.fstfaceswap 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
Projectto the internal_tasksdict.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
Projectwhen 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
Tasksclass.Tasks can be loaded from project
.fswfiles or task.fstfiles, 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) –
Trueif the task to be loaded must be for the currently selected tab.Falseif loading a task into any tab. If current_tab is True then tasks can be loaded from.fswand.fstfiles, otherwise they can only be loaded from.fstfiles. 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
.fstfaceswap 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