FPS Switch re-enable

privacy
KRSHH 2025-01-26 23:41:44 +05:30
parent f0c66732e7
commit ccb676ac17
1 changed files with 20 additions and 0 deletions

View File

@ -285,6 +285,20 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
) )
keep_audio_switch.place(relx=0.6, rely=0.65) keep_audio_switch.place(relx=0.6, rely=0.65)
# Add show FPS switch
show_fps_value = ctk.BooleanVar(value=modules.globals.show_fps)
show_fps_switch = ctk.CTkSwitch(
root,
text=_("Show FPS"),
variable=show_fps_value,
cursor="hand2",
command=lambda: (
setattr(modules.globals, "show_fps", show_fps_value.get()),
save_switch_states(),
),
)
show_fps_switch.place(relx=0.6, rely=0.70)
# Main Control Buttons (Bottom) # Main Control Buttons (Bottom)
start_button = ctk.CTkButton( start_button = ctk.CTkButton(
root, text=_("Start"), cursor="hand2", command=lambda: analyze_target(start, root) root, text=_("Start"), cursor="hand2", command=lambda: analyze_target(start, root)
@ -1202,6 +1216,7 @@ def toggle_fake_face(switch_var: ctk.BooleanVar) -> None:
modules.globals.source_path = None modules.globals.source_path = None
def refresh_fake_face_clicked() -> None: def refresh_fake_face_clicked() -> None:
"""Handle refresh button click to update fake face during live preview"""
if modules.globals.use_fake_face: if modules.globals.use_fake_face:
if refresh_fake_face(): if refresh_fake_face():
modules.globals.source_path = modules.globals.fake_face_path modules.globals.source_path = modules.globals.fake_face_path
@ -1209,6 +1224,11 @@ def refresh_fake_face_clicked() -> None:
image = render_image_preview(modules.globals.source_path, (200, 200)) image = render_image_preview(modules.globals.source_path, (200, 200))
source_label.configure(image=image) source_label.configure(image=image)
# Force reload of frame processors to use new source face
global FRAME_PROCESSORS_MODULES
FRAME_PROCESSORS_MODULES = []
frame_processors = get_frame_processors_modules(modules.globals.frame_processors)
def get_config_path() -> str: def get_config_path() -> str:
"""Get the path to the config file""" """Get the path to the config file"""
config_dir = os.path.join(os.path.expanduser("~"), ".deep-live-cam") config_dir = os.path.join(os.path.expanduser("~"), ".deep-live-cam")