Config
- class lib.gui.utils.config.Config(root: tk.Tk, cli_opts: CliOptions | None, statusbar: StatusBar | None)
Bases:
objectThe centralized configuration class for holding items that should be made available to all parts of the GUI.
This class should be initialized on GUI startup through
initialize_config(). Any further access to this class should be throughget_config().- Parameters:
root (
tkinter.Tk) – The root Tkinter objectcli_opts (
lib.gui.options.CliOptionsorNone) – The command line options object. Must be provided for main GUI. Must beNonefor toolsstatusbar (
lib.gui.custom_widgets.StatusBarorNone) – The GUI Status bar. Must be provided for main GUI. Must beNonefor tools
Attributes Summary
The command line options for this GUI Session.
The main Faceswap Command Notebook.
The selected font as configured in user settings.
The default options for all tabs
The command notebook modified tkinter variables.
The path to the GUI cache folder
The project session handler.
The root tkinter window.
The scaling factor for current display.
The GUI StatusBar
tkinter.ttk.Frame.The session tasks handler.
The global tkinter variables.
The Faceswap Tools sub-Notebook.
The GUI theme selection options.
Methods Summary
set_active_tab_by_name(name)Sets the
command_notebookortools_notebookto active based on given name.set_command_notebook(notebook)Set the command notebook to the
command_notebookattribute and enable the modified callback forproject.set_cursor_busy([widget])Set the root or widget cursor to busy.
set_cursor_default([widget])Set the root or widget cursor to default.
Set the default options for
lib.gui.projectsset_geometry(width, height[, fullscreen])Set the geometry for the root tkinter object.
set_modified_true(command)Set the modified variable to
Truefor the given command inmodified_vars.set_root_title([text])Set the main title text for Faceswap.
Attributes Documentation
- cli_opts
The command line options for this GUI Session.
- command_notebook
The main Faceswap Command Notebook.
- default_font
The selected font as configured in user settings. First item is the font (str) second item the font size (int).
- Type:
tuple
- default_options
The default options for all tabs
- Type:
dict
- modified_vars
The command notebook modified tkinter variables.
- Type:
dict
- path_cache
The path to the GUI cache folder
- Type:
str
- project
The project session handler.
- Type:
- root
The root tkinter window.
- Type:
tkinter.Tk
- scaling_factor
The scaling factor for current display.
- Type:
float
- statusbar
The GUI StatusBar
tkinter.ttk.Frame.
- tasks
The session tasks handler.
- Type:
- tk_vars
The global tkinter variables.
- Type:
dict
- tools_notebook
The Faceswap Tools sub-Notebook.
- user_theme
The GUI theme selection options.
- Type:
dict
Methods Documentation
- set_active_tab_by_name(name: str) None
Sets the
command_notebookortools_notebookto active based on given name.- Parameters:
name (str) – The name of the tab to set active
- Return type:
None
- set_command_notebook(notebook: CommandNotebook) None
Set the command notebook to the
command_notebookattribute and enable the modified callback forproject.- Parameters:
notebook (
lib.gui.command.CommandNotebook) – The main command notebook for the Faceswap GUI- Return type:
None
- set_cursor_busy(widget: Widget | None = None) None
Set the root or widget cursor to busy.
- Parameters:
widget (tkinter object, optional) – The widget to set busy cursor for. If the provided value is
Nonethen sets the cursor busy for the whole of the GUI. Default:None.- Return type:
None
- set_cursor_default(widget: Widget | None = None) None
Set the root or widget cursor to default.
- Parameters:
widget (tkinter object, optional) – The widget to set default cursor for. If the provided value is
Nonethen sets the cursor busy for the whole of the GUI. Default:None- Return type:
None
- set_default_options() None
Set the default options for
lib.gui.projectsThe Default GUI options are stored on Faceswap startup.
Exposed as the
_default_optsfor a project cannot be set until after the main Command Tabs have been loaded.- Return type:
None
- set_geometry(width: int, height: int, fullscreen: bool = False) None
Set the geometry for the root tkinter object.
- Parameters:
width (int) – The width to set the window to (prior to scaling)
height (int) – The height to set the window to (prior to scaling)
fullscreen (bool, optional) – Whether to set the window to full-screen mode. If
Truethenwidthandheightare ignored. Default:False
- Return type:
None
- set_modified_true(command: str) None
Set the modified variable to
Truefor the given command inmodified_vars.- Parameters:
command (str) – The command to set the modified state to
True- Return type:
None
- set_root_title(text: str | None = None) None
Set the main title text for Faceswap.
The title will always begin with ‘Faceswap.py’. Additional text can be appended.
- Parameters:
text (str, optional) – Additional text to be appended to the GUI title bar. Default:
None- Return type:
None
- property cli_opts: CliOptions
The command line options for this GUI Session.
- property command_notebook: CommandNotebook | None
The main Faceswap Command Notebook.
- property default_font: tuple[str, int]
The selected font as configured in user settings. First item is the font (str) second item the font size (int).
- Type:
tuple
- property default_options: dict[str, dict[str, Any]]
The default options for all tabs
- Type:
dict
- property modified_vars: dict[str, BooleanVar]
The command notebook modified tkinter variables.
- Type:
dict
- property path_cache: str
The path to the GUI cache folder
- Type:
str
- property root: Tk
The root tkinter window.
- Type:
tkinter.Tk
- property scaling_factor: float
The scaling factor for current display.
- Type:
float
- set_active_tab_by_name(name: str) None
Sets the
command_notebookortools_notebookto active based on given name.- Parameters:
name (str) – The name of the tab to set active
- Return type:
None
- set_command_notebook(notebook: CommandNotebook) None
Set the command notebook to the
command_notebookattribute and enable the modified callback forproject.- Parameters:
notebook (
lib.gui.command.CommandNotebook) – The main command notebook for the Faceswap GUI- Return type:
None
- set_cursor_busy(widget: Widget | None = None) None
Set the root or widget cursor to busy.
- Parameters:
widget (tkinter object, optional) – The widget to set busy cursor for. If the provided value is
Nonethen sets the cursor busy for the whole of the GUI. Default:None.- Return type:
None
- set_cursor_default(widget: Widget | None = None) None
Set the root or widget cursor to default.
- Parameters:
widget (tkinter object, optional) – The widget to set default cursor for. If the provided value is
Nonethen sets the cursor busy for the whole of the GUI. Default:None- Return type:
None
- set_default_options() None
Set the default options for
lib.gui.projectsThe Default GUI options are stored on Faceswap startup.
Exposed as the
_default_optsfor a project cannot be set until after the main Command Tabs have been loaded.- Return type:
None
- set_geometry(width: int, height: int, fullscreen: bool = False) None
Set the geometry for the root tkinter object.
- Parameters:
width (int) – The width to set the window to (prior to scaling)
height (int) – The height to set the window to (prior to scaling)
fullscreen (bool, optional) – Whether to set the window to full-screen mode. If
Truethenwidthandheightare ignored. Default:False
- Return type:
None
- set_modified_true(command: str) None
Set the modified variable to
Truefor the given command inmodified_vars.- Parameters:
command (str) – The command to set the modified state to
True- Return type:
None
- set_root_title(text: str | None = None) None
Set the main title text for Faceswap.
The title will always begin with ‘Faceswap.py’. Additional text can be appended.
- Parameters:
text (str, optional) – Additional text to be appended to the GUI title bar. Default:
None- Return type:
None
- property tk_vars: GlobalVariables
The global tkinter variables.
- Type:
dict
- property tools_notebook: ToolsNotebook
The Faceswap Tools sub-Notebook.
- property user_theme: dict[str, Any]
The GUI theme selection options.
- Type:
dict