fix
parent
40e47a469c
commit
75b5b096d6
|
@ -42,18 +42,29 @@ def get_frame_processors_modules(frame_processors: List[str]) -> List[ModuleType
|
||||||
|
|
||||||
def set_frame_processors_modules_from_ui(frame_processors: List[str]) -> None:
|
def set_frame_processors_modules_from_ui(frame_processors: List[str]) -> None:
|
||||||
global FRAME_PROCESSORS_MODULES
|
global FRAME_PROCESSORS_MODULES
|
||||||
|
current_processor_names = [proc.__name__.split('.')[-1] for proc in FRAME_PROCESSORS_MODULES]
|
||||||
|
|
||||||
for frame_processor, state in modules.globals.fp_ui.items():
|
for frame_processor, state in modules.globals.fp_ui.items():
|
||||||
if state == True and frame_processor not in frame_processors:
|
if state == True and frame_processor not in current_processor_names:
|
||||||
frame_processor_module = load_frame_processor_module(frame_processor)
|
|
||||||
FRAME_PROCESSORS_MODULES.append(frame_processor_module)
|
|
||||||
modules.globals.frame_processors.append(frame_processor)
|
|
||||||
if state == False:
|
|
||||||
try:
|
try:
|
||||||
frame_processor_module = load_frame_processor_module(frame_processor)
|
frame_processor_module = load_frame_processor_module(frame_processor)
|
||||||
FRAME_PROCESSORS_MODULES.remove(frame_processor_module)
|
FRAME_PROCESSORS_MODULES.append(frame_processor_module)
|
||||||
modules.globals.frame_processors.remove(frame_processor)
|
if frame_processor not in modules.globals.frame_processors:
|
||||||
except:
|
modules.globals.frame_processors.append(frame_processor)
|
||||||
pass
|
except SystemExit:
|
||||||
|
print(f"Warning: Failed to load frame processor {frame_processor} requested by UI state.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Warning: Error loading frame processor {frame_processor} requested by UI state: {e}")
|
||||||
|
|
||||||
|
elif state == False and frame_processor in current_processor_names:
|
||||||
|
try:
|
||||||
|
module_to_remove = next((mod for mod in FRAME_PROCESSORS_MODULES if mod.__name__.endswith(f'.{frame_processor}')), None)
|
||||||
|
if module_to_remove:
|
||||||
|
FRAME_PROCESSORS_MODULES.remove(module_to_remove)
|
||||||
|
if frame_processor in modules.globals.frame_processors:
|
||||||
|
modules.globals.frame_processors.remove(frame_processor)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Warning: Error removing frame processor {frame_processor}: {e}")
|
||||||
|
|
||||||
def multi_process_frame(source_path: str, temp_frame_paths: List[str], process_frames: Callable[[str, List[str], Any], None], progress: Any = None) -> None:
|
def multi_process_frame(source_path: str, temp_frame_paths: List[str], process_frames: Callable[[str, List[str], Any], None], progress: Any = None) -> None:
|
||||||
with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor:
|
with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor:
|
||||||
|
|
Loading…
Reference in New Issue