|
|
|
@ -26,6 +26,7 @@ from modules.utilities import (
|
|
|
|
|
has_image_extension,
|
|
|
|
|
)
|
|
|
|
|
from modules.video_capture import VideoCapturer
|
|
|
|
|
from modules.gettext import LanguageManager
|
|
|
|
|
import platform
|
|
|
|
|
|
|
|
|
|
if platform.system() == "Windows":
|
|
|
|
@ -63,6 +64,7 @@ RECENT_DIRECTORY_SOURCE = None
|
|
|
|
|
RECENT_DIRECTORY_TARGET = None
|
|
|
|
|
RECENT_DIRECTORY_OUTPUT = None
|
|
|
|
|
|
|
|
|
|
_ = None
|
|
|
|
|
preview_label = None
|
|
|
|
|
preview_slider = None
|
|
|
|
|
source_label = None
|
|
|
|
@ -77,9 +79,11 @@ target_label_dict_live = {}
|
|
|
|
|
img_ft, vid_ft = modules.globals.file_types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def init(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.CTk:
|
|
|
|
|
global ROOT, PREVIEW
|
|
|
|
|
def init(start: Callable[[], None], destroy: Callable[[], None], lang: str) -> ctk.CTk:
|
|
|
|
|
global ROOT, PREVIEW, _
|
|
|
|
|
|
|
|
|
|
lang_manager = LanguageManager(lang)
|
|
|
|
|
_ = lang_manager._
|
|
|
|
|
ROOT = create_root(start, destroy)
|
|
|
|
|
PREVIEW = create_preview(ROOT)
|
|
|
|
|
|
|
|
|
@ -154,7 +158,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
target_label.place(relx=0.6, rely=0.1, relwidth=0.3, relheight=0.25)
|
|
|
|
|
|
|
|
|
|
select_face_button = ctk.CTkButton(
|
|
|
|
|
root, text="Select a face", cursor="hand2", command=lambda: select_source_path()
|
|
|
|
|
root, text=_("Select a face"), cursor="hand2", command=lambda: select_source_path()
|
|
|
|
|
)
|
|
|
|
|
select_face_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
|
|
|
|
|
|
|
|
|
@ -165,7 +169,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
|
|
|
|
|
select_target_button = ctk.CTkButton(
|
|
|
|
|
root,
|
|
|
|
|
text="Select a target",
|
|
|
|
|
text=_("Select a target"),
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: select_target_path(),
|
|
|
|
|
)
|
|
|
|
@ -174,7 +178,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
keep_fps_value = ctk.BooleanVar(value=modules.globals.keep_fps)
|
|
|
|
|
keep_fps_checkbox = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Keep fps",
|
|
|
|
|
text=_("Keep fps"),
|
|
|
|
|
variable=keep_fps_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -187,7 +191,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
keep_frames_value = ctk.BooleanVar(value=modules.globals.keep_frames)
|
|
|
|
|
keep_frames_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Keep frames",
|
|
|
|
|
text=_("Keep frames"),
|
|
|
|
|
variable=keep_frames_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -200,7 +204,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
enhancer_value = ctk.BooleanVar(value=modules.globals.fp_ui["face_enhancer"])
|
|
|
|
|
enhancer_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Face Enhancer",
|
|
|
|
|
text=_("Face Enhancer"),
|
|
|
|
|
variable=enhancer_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -213,7 +217,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
keep_audio_value = ctk.BooleanVar(value=modules.globals.keep_audio)
|
|
|
|
|
keep_audio_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Keep audio",
|
|
|
|
|
text=_("Keep audio"),
|
|
|
|
|
variable=keep_audio_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -226,7 +230,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
many_faces_value = ctk.BooleanVar(value=modules.globals.many_faces)
|
|
|
|
|
many_faces_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Many faces",
|
|
|
|
|
text=_("Many faces"),
|
|
|
|
|
variable=many_faces_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -239,7 +243,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
color_correction_value = ctk.BooleanVar(value=modules.globals.color_correction)
|
|
|
|
|
color_correction_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Fix Blueish Cam",
|
|
|
|
|
text=_("Fix Blueish Cam"),
|
|
|
|
|
variable=color_correction_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -256,7 +260,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
map_faces = ctk.BooleanVar(value=modules.globals.map_faces)
|
|
|
|
|
map_faces_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Map faces",
|
|
|
|
|
text=_("Map faces"),
|
|
|
|
|
variable=map_faces,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -269,7 +273,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
show_fps_value = ctk.BooleanVar(value=modules.globals.show_fps)
|
|
|
|
|
show_fps_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Show FPS",
|
|
|
|
|
text=_("Show FPS"),
|
|
|
|
|
variable=show_fps_value,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: (
|
|
|
|
@ -282,7 +286,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
mouth_mask_var = ctk.BooleanVar(value=modules.globals.mouth_mask)
|
|
|
|
|
mouth_mask_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Mouth Mask",
|
|
|
|
|
text=_("Mouth Mask"),
|
|
|
|
|
variable=mouth_mask_var,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: setattr(modules.globals, "mouth_mask", mouth_mask_var.get()),
|
|
|
|
@ -292,7 +296,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
show_mouth_mask_box_var = ctk.BooleanVar(value=modules.globals.show_mouth_mask_box)
|
|
|
|
|
show_mouth_mask_box_switch = ctk.CTkSwitch(
|
|
|
|
|
root,
|
|
|
|
|
text="Show Mouth Mask Box",
|
|
|
|
|
text=_("Show Mouth Mask Box"),
|
|
|
|
|
variable=show_mouth_mask_box_var,
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: setattr(
|
|
|
|
@ -302,22 +306,22 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
show_mouth_mask_box_switch.place(relx=0.6, rely=0.55)
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
)
|
|
|
|
|
start_button.place(relx=0.15, rely=0.80, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
|
stop_button = ctk.CTkButton(
|
|
|
|
|
root, text="Destroy", cursor="hand2", command=lambda: destroy()
|
|
|
|
|
root, text=_("Destroy"), cursor="hand2", command=lambda: destroy()
|
|
|
|
|
)
|
|
|
|
|
stop_button.place(relx=0.4, rely=0.80, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
|
preview_button = ctk.CTkButton(
|
|
|
|
|
root, text="Preview", cursor="hand2", command=lambda: toggle_preview()
|
|
|
|
|
root, text=_("Preview"), cursor="hand2", command=lambda: toggle_preview()
|
|
|
|
|
)
|
|
|
|
|
preview_button.place(relx=0.65, rely=0.80, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
|
# --- Camera Selection ---
|
|
|
|
|
camera_label = ctk.CTkLabel(root, text="Select Camera:")
|
|
|
|
|
camera_label = ctk.CTkLabel(root, text=_("Select Camera:"))
|
|
|
|
|
camera_label.place(relx=0.1, rely=0.86, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
|
available_cameras = get_available_cameras()
|
|
|
|
@ -341,7 +345,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
|
|
|
|
|
live_button = ctk.CTkButton(
|
|
|
|
|
root,
|
|
|
|
|
text="Live",
|
|
|
|
|
text=_("Live"),
|
|
|
|
|
cursor="hand2",
|
|
|
|
|
command=lambda: webcam_preview(
|
|
|
|
|
root,
|
|
|
|
@ -379,23 +383,23 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
|
|
|
|
|
|
|
|
|
def analyze_target(start: Callable[[], None], root: ctk.CTk):
|
|
|
|
|
if POPUP != None and POPUP.winfo_exists():
|
|
|
|
|
update_status("Please complete pop-up or close it.")
|
|
|
|
|
update_status(_("Please complete pop-up or close it."))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if modules.globals.map_faces:
|
|
|
|
|
modules.globals.souce_target_map = []
|
|
|
|
|
|
|
|
|
|
if is_image(modules.globals.target_path):
|
|
|
|
|
update_status("Getting unique faces")
|
|
|
|
|
update_status(_("Getting unique faces"))
|
|
|
|
|
get_unique_faces_from_target_image()
|
|
|
|
|
elif is_video(modules.globals.target_path):
|
|
|
|
|
update_status("Getting unique faces")
|
|
|
|
|
update_status(_("Getting unique faces"))
|
|
|
|
|
get_unique_faces_from_target_video()
|
|
|
|
|
|
|
|
|
|
if len(modules.globals.souce_target_map) > 0:
|
|
|
|
|
create_source_target_popup(start, root, modules.globals.souce_target_map)
|
|
|
|
|
else:
|
|
|
|
|
update_status("No faces found in target")
|
|
|
|
|
update_status(_("No faces found in target"))
|
|
|
|
|
else:
|
|
|
|
|
select_output_path(start)
|
|
|
|
|
|
|
|
|
@ -406,7 +410,7 @@ def create_source_target_popup(
|
|
|
|
|
global POPUP, popup_status_label
|
|
|
|
|
|
|
|
|
|
POPUP = ctk.CTkToplevel(root)
|
|
|
|
|
POPUP.title("Source x Target Mapper")
|
|
|
|
|
POPUP.title(_("Source x Target Mapper"))
|
|
|
|
|
POPUP.geometry(f"{POPUP_WIDTH}x{POPUP_HEIGHT}")
|
|
|
|
|
POPUP.focus()
|
|
|
|
|
|
|
|
|
@ -430,7 +434,7 @@ def create_source_target_popup(
|
|
|
|
|
|
|
|
|
|
button = ctk.CTkButton(
|
|
|
|
|
scrollable_frame,
|
|
|
|
|
text="Select source image",
|
|
|
|
|
text=_("Select source image"),
|
|
|
|
|
command=lambda id=id: on_button_click(map, id),
|
|
|
|
|
width=DEFAULT_BUTTON_WIDTH,
|
|
|
|
|
height=DEFAULT_BUTTON_HEIGHT,
|
|
|
|
@ -464,7 +468,7 @@ def create_source_target_popup(
|
|
|
|
|
popup_status_label.grid(row=1, column=0, pady=15)
|
|
|
|
|
|
|
|
|
|
close_button = ctk.CTkButton(
|
|
|
|
|
POPUP, text="Submit", command=lambda: on_submit_click(start)
|
|
|
|
|
POPUP, text=_("Submit"), command=lambda: on_submit_click(start)
|
|
|
|
|
)
|
|
|
|
|
close_button.grid(row=2, column=0, pady=10)
|
|
|
|
|
|
|
|
|
@ -475,7 +479,7 @@ def update_popup_source(
|
|
|
|
|
global source_label_dict
|
|
|
|
|
|
|
|
|
|
source_path = ctk.filedialog.askopenfilename(
|
|
|
|
|
title="select an source image",
|
|
|
|
|
title=_("select an source image"),
|
|
|
|
|
initialdir=RECENT_DIRECTORY_SOURCE,
|
|
|
|
|
filetypes=[img_ft],
|
|
|
|
|
)
|
|
|
|
@ -517,7 +521,7 @@ def update_popup_source(
|
|
|
|
|
source_image.configure(image=tk_image)
|
|
|
|
|
source_label_dict[button_num] = source_image
|
|
|
|
|
else:
|
|
|
|
|
update_pop_status("Face could not be detected in last upload!")
|
|
|
|
|
update_pop_status(_("Face could not be detected in last upload!"))
|
|
|
|
|
return map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -526,7 +530,7 @@ def create_preview(parent: ctk.CTkToplevel) -> ctk.CTkToplevel:
|
|
|
|
|
|
|
|
|
|
preview = ctk.CTkToplevel(parent)
|
|
|
|
|
preview.withdraw()
|
|
|
|
|
preview.title("Preview")
|
|
|
|
|
preview.title(_("Preview"))
|
|
|
|
|
preview.configure()
|
|
|
|
|
preview.protocol("WM_DELETE_WINDOW", lambda: toggle_preview())
|
|
|
|
|
preview.resizable(width=True, height=True)
|
|
|
|
@ -542,16 +546,16 @@ def create_preview(parent: ctk.CTkToplevel) -> ctk.CTkToplevel:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_status(text: str) -> None:
|
|
|
|
|
status_label.configure(text=text)
|
|
|
|
|
status_label.configure(text=_(text))
|
|
|
|
|
ROOT.update()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_pop_status(text: str) -> None:
|
|
|
|
|
popup_status_label.configure(text=text)
|
|
|
|
|
popup_status_label.configure(text=_(text))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_pop_live_status(text: str) -> None:
|
|
|
|
|
popup_status_label_live.configure(text=text)
|
|
|
|
|
popup_status_label_live.configure(text=_(text))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_tumbler(var: str, value: bool) -> None:
|
|
|
|
@ -570,7 +574,7 @@ def select_source_path() -> None:
|
|
|
|
|
|
|
|
|
|
PREVIEW.withdraw()
|
|
|
|
|
source_path = ctk.filedialog.askopenfilename(
|
|
|
|
|
title="select an source image",
|
|
|
|
|
title=_("select an source image"),
|
|
|
|
|
initialdir=RECENT_DIRECTORY_SOURCE,
|
|
|
|
|
filetypes=[img_ft],
|
|
|
|
|
)
|
|
|
|
@ -613,7 +617,7 @@ def select_target_path() -> None:
|
|
|
|
|
|
|
|
|
|
PREVIEW.withdraw()
|
|
|
|
|
target_path = ctk.filedialog.askopenfilename(
|
|
|
|
|
title="select an target image or video",
|
|
|
|
|
title=_("select an target image or video"),
|
|
|
|
|
initialdir=RECENT_DIRECTORY_TARGET,
|
|
|
|
|
filetypes=[img_ft, vid_ft],
|
|
|
|
|
)
|
|
|
|
@ -637,7 +641,7 @@ def select_output_path(start: Callable[[], None]) -> None:
|
|
|
|
|
|
|
|
|
|
if is_image(modules.globals.target_path):
|
|
|
|
|
output_path = ctk.filedialog.asksaveasfilename(
|
|
|
|
|
title="save image output file",
|
|
|
|
|
title=_("save image output file"),
|
|
|
|
|
filetypes=[img_ft],
|
|
|
|
|
defaultextension=".png",
|
|
|
|
|
initialfile="output.png",
|
|
|
|
@ -645,7 +649,7 @@ def select_output_path(start: Callable[[], None]) -> None:
|
|
|
|
|
)
|
|
|
|
|
elif is_video(modules.globals.target_path):
|
|
|
|
|
output_path = ctk.filedialog.asksaveasfilename(
|
|
|
|
|
title="save video output file",
|
|
|
|
|
title=_("save video output file"),
|
|
|
|
|
filetypes=[vid_ft],
|
|
|
|
|
defaultextension=".mp4",
|
|
|
|
|
initialfile="output.mp4",
|
|
|
|
@ -675,7 +679,7 @@ def check_and_ignore_nsfw(target, destroy: Callable = None) -> bool:
|
|
|
|
|
destroy(
|
|
|
|
|
to_quit=False
|
|
|
|
|
) # Do not need to destroy the window frame if the target is NSFW
|
|
|
|
|
update_status("Processing ignored!")
|
|
|
|
|
update_status(_("Processing ignored!"))
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
@ -739,7 +743,7 @@ def init_preview() -> None:
|
|
|
|
|
|
|
|
|
|
def update_preview(frame_number: int = 0) -> None:
|
|
|
|
|
if modules.globals.source_path and modules.globals.target_path:
|
|
|
|
|
update_status("Processing...")
|
|
|
|
|
update_status(_("Processing..."))
|
|
|
|
|
temp_frame = get_video_frame(modules.globals.target_path, frame_number)
|
|
|
|
|
if modules.globals.nsfw_filter and check_and_ignore_nsfw(temp_frame):
|
|
|
|
|
return
|
|
|
|
@ -755,14 +759,14 @@ def update_preview(frame_number: int = 0) -> None:
|
|
|
|
|
)
|
|
|
|
|
image = ctk.CTkImage(image, size=image.size)
|
|
|
|
|
preview_label.configure(image=image)
|
|
|
|
|
update_status("Processing succeed!")
|
|
|
|
|
update_status(_("Processing succeed!"))
|
|
|
|
|
PREVIEW.deiconify()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def webcam_preview(root: ctk.CTk, camera_index: int):
|
|
|
|
|
if not modules.globals.map_faces:
|
|
|
|
|
if modules.globals.source_path is None:
|
|
|
|
|
update_status("Please select a source image first")
|
|
|
|
|
update_status(_("Please select a source image first"))
|
|
|
|
|
return
|
|
|
|
|
create_webcam_preview(camera_index)
|
|
|
|
|
else:
|
|
|
|
@ -847,7 +851,7 @@ def create_webcam_preview(camera_index: int):
|
|
|
|
|
|
|
|
|
|
cap = VideoCapturer(camera_index)
|
|
|
|
|
if not cap.start(PREVIEW_DEFAULT_WIDTH, PREVIEW_DEFAULT_HEIGHT, 60):
|
|
|
|
|
update_status("Failed to start camera")
|
|
|
|
|
update_status(_("Failed to start camera"))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
preview_label.configure(width=PREVIEW_DEFAULT_WIDTH, height=PREVIEW_DEFAULT_HEIGHT)
|
|
|
|
@ -940,7 +944,7 @@ def create_source_target_popup_for_webcam(
|
|
|
|
|
global POPUP_LIVE, popup_status_label_live
|
|
|
|
|
|
|
|
|
|
POPUP_LIVE = ctk.CTkToplevel(root)
|
|
|
|
|
POPUP_LIVE.title("Source x Target Mapper")
|
|
|
|
|
POPUP_LIVE.title(_("Source x Target Mapper"))
|
|
|
|
|
POPUP_LIVE.geometry(f"{POPUP_LIVE_WIDTH}x{POPUP_LIVE_HEIGHT}")
|
|
|
|
|
POPUP_LIVE.focus()
|
|
|
|
|
|
|
|
|
@ -950,21 +954,21 @@ def create_source_target_popup_for_webcam(
|
|
|
|
|
simplify_maps()
|
|
|
|
|
create_webcam_preview(camera_index)
|
|
|
|
|
else:
|
|
|
|
|
update_pop_live_status("At least 1 source with target is required!")
|
|
|
|
|
update_pop_live_status(_("At least 1 source with target is required!"))
|
|
|
|
|
|
|
|
|
|
def on_add_click():
|
|
|
|
|
add_blank_map()
|
|
|
|
|
refresh_data(map)
|
|
|
|
|
update_pop_live_status("Please provide mapping!")
|
|
|
|
|
update_pop_live_status(_("Please provide mapping!"))
|
|
|
|
|
|
|
|
|
|
popup_status_label_live = ctk.CTkLabel(POPUP_LIVE, text=None, justify="center")
|
|
|
|
|
popup_status_label_live.grid(row=1, column=0, pady=15)
|
|
|
|
|
|
|
|
|
|
add_button = ctk.CTkButton(POPUP_LIVE, text="Add", command=lambda: on_add_click())
|
|
|
|
|
add_button = ctk.CTkButton(POPUP_LIVE, text=_("Add"), command=lambda: on_add_click())
|
|
|
|
|
add_button.place(relx=0.2, rely=0.92, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
|
close_button = ctk.CTkButton(
|
|
|
|
|
POPUP_LIVE, text="Submit", command=lambda: on_submit_click()
|
|
|
|
|
POPUP_LIVE, text=_("Submit"), command=lambda: on_submit_click()
|
|
|
|
|
)
|
|
|
|
|
close_button.place(relx=0.6, rely=0.92, relwidth=0.2, relheight=0.05)
|
|
|
|
|
|
|
|
|
@ -988,7 +992,7 @@ def refresh_data(map: list):
|
|
|
|
|
|
|
|
|
|
button = ctk.CTkButton(
|
|
|
|
|
scrollable_frame,
|
|
|
|
|
text="Select source image",
|
|
|
|
|
text=_("Select source image"),
|
|
|
|
|
command=lambda id=id: on_sbutton_click(map, id),
|
|
|
|
|
width=DEFAULT_BUTTON_WIDTH,
|
|
|
|
|
height=DEFAULT_BUTTON_HEIGHT,
|
|
|
|
@ -1005,7 +1009,7 @@ def refresh_data(map: list):
|
|
|
|
|
|
|
|
|
|
button = ctk.CTkButton(
|
|
|
|
|
scrollable_frame,
|
|
|
|
|
text="Select target image",
|
|
|
|
|
text=_("Select target image"),
|
|
|
|
|
command=lambda id=id: on_tbutton_click(map, id),
|
|
|
|
|
width=DEFAULT_BUTTON_WIDTH,
|
|
|
|
|
height=DEFAULT_BUTTON_HEIGHT,
|
|
|
|
@ -1055,7 +1059,7 @@ def update_webcam_source(
|
|
|
|
|
global source_label_dict_live
|
|
|
|
|
|
|
|
|
|
source_path = ctk.filedialog.askopenfilename(
|
|
|
|
|
title="select an source image",
|
|
|
|
|
title=_("select an source image"),
|
|
|
|
|
initialdir=RECENT_DIRECTORY_SOURCE,
|
|
|
|
|
filetypes=[img_ft],
|
|
|
|
|
)
|
|
|
|
@ -1097,7 +1101,7 @@ def update_webcam_source(
|
|
|
|
|
source_image.configure(image=tk_image)
|
|
|
|
|
source_label_dict_live[button_num] = source_image
|
|
|
|
|
else:
|
|
|
|
|
update_pop_live_status("Face could not be detected in last upload!")
|
|
|
|
|
update_pop_live_status(_("Face could not be detected in last upload!"))
|
|
|
|
|
return map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1107,7 +1111,7 @@ def update_webcam_target(
|
|
|
|
|
global target_label_dict_live
|
|
|
|
|
|
|
|
|
|
target_path = ctk.filedialog.askopenfilename(
|
|
|
|
|
title="select an target image",
|
|
|
|
|
title=_("select an target image"),
|
|
|
|
|
initialdir=RECENT_DIRECTORY_SOURCE,
|
|
|
|
|
filetypes=[img_ft],
|
|
|
|
|
)
|
|
|
|
@ -1149,5 +1153,5 @@ def update_webcam_target(
|
|
|
|
|
target_image.configure(image=tk_image)
|
|
|
|
|
target_label_dict_live[button_num] = target_image
|
|
|
|
|
else:
|
|
|
|
|
update_pop_live_status("Face could not be detected in last upload!")
|
|
|
|
|
update_pop_live_status(_("Face could not be detected in last upload!"))
|
|
|
|
|
return map
|
|
|
|
|