Project
- class lib.gui.project.Project(config: Config, file_handler: type[FileHandler])
Bases:
_GuiSessionFaceswap
.fswProject File handling.Faceswap projects handle the management of all task tabs in the GUI and updates the main Faceswap title bar with the project name and modified state.
- Parameters:
config (Config) – The master GUI config
file_handler (type[FileHandler]) – A file handler object
Attributes Summary
The raw cli options from
_optionswith project fields removed.The currently active project filename.
Methods Summary
close(*args)Clear the current project and set all options to default.
Pop a message box to get confirmation that an unsaved project should be closed
load(*args[, filename, last_session])Load a project from a saved
.fswproject file.new(*args)Create a new project with default options.
reload(*args)Reset all GUI's option tabs to their last saved state.
save(*args[, save_as])Save the current GUI state to a
.fswproject file.Set the default options.
Adds a callback to each of the
_modified_varstkinter variables When one of these variables is changed, triggers_modified_callback()with the command that was changed.Attributes Documentation
- cli_options
The raw cli options from
_optionswith project fields removed.
- filename
The currently active project filename.
Methods Documentation
- close(*args) None
Clear the current project and set all options to default.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- confirm_close() bool
Pop a message box to get confirmation that an unsaved project should be closed
- Return type:
Trueif user confirms close,Falseif user cancels close
- load(*args, filename: str | None = None, last_session: bool = False) None
Load a project from a saved
.fswproject file.- 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.
last_session (bool) –
Trueif the project is being loaded from the last opened sessionFalseif the project is being loaded directly from disk. Default:False
- Return type:
None
- new(*args) None
Create a new project with default options.
Pops a file handler to select location.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- reload(*args) None
Reset all GUI’s option tabs to their last saved state.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- save(*args, save_as: bool = False) None
Save the current GUI state to a
.fswproject file.- Parameters:
*args (tuple) – Unused, but needs to be present for arguments passed by tkinter event handling
save_as (bool, optional) – 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.
- Return type:
None
- set_default_options() None
Set the default options. The Default GUI options are stored on Faceswap startup.
Exposed as the
_default_optionsfor a project cannot be set until after the main Command Tabs have been loaded.- Return type:
None
- set_modified_callback() None
Adds a callback to each of the
_modified_varstkinter variables When one of these variables is changed, triggers_modified_callback()with the command that was changed.This is exposed as the callback can only be added after the main Command Tabs have been drawn, and their options’ initial values have been set.
- Return type:
None
- property cli_options: dict[str, dict[str, bool | int | float | str]]
The raw cli options from
_optionswith project fields removed.
- close(*args) None
Clear the current project and set all options to default.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- confirm_close() bool
Pop a message box to get confirmation that an unsaved project should be closed
- Return type:
Trueif user confirms close,Falseif user cancels close
- property filename: str | None
The currently active project filename.
- load(*args, filename: str | None = None, last_session: bool = False) None
Load a project from a saved
.fswproject file.- 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.
last_session (bool) –
Trueif the project is being loaded from the last opened sessionFalseif the project is being loaded directly from disk. Default:False
- Return type:
None
- new(*args) None
Create a new project with default options.
Pops a file handler to select location.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- reload(*args) None
Reset all GUI’s option tabs to their last saved state.
- Parameters:
*args – Unused, but needs to be present for arguments passed by tkinter event handling
- Return type:
None
- save(*args, save_as: bool = False) None
Save the current GUI state to a
.fswproject file.- Parameters:
*args (tuple) – Unused, but needs to be present for arguments passed by tkinter event handling
save_as (bool, optional) – 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.
- Return type:
None
- set_default_options() None
Set the default options. The Default GUI options are stored on Faceswap startup.
Exposed as the
_default_optionsfor a project cannot be set until after the main Command Tabs have been loaded.- Return type:
None
- set_modified_callback() None
Adds a callback to each of the
_modified_varstkinter variables When one of these variables is changed, triggers_modified_callback()with the command that was changed.This is exposed as the callback can only be added after the main Command Tabs have been drawn, and their options’ initial values have been set.
- Return type:
None