added clearing the log / terminal as an option

This commit is contained in:
patientx 2025-10-04 20:43:34 +03:00 committed by GitHub
parent 47a10707ad
commit 32438729d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,7 @@ class save_conditioning:
RETURN_TYPES = ("CONDITIONING",) RETURN_TYPES = ("CONDITIONING",)
RETURN_NAMES = ("conditioning",) RETURN_NAMES = ("conditioning",)
FUNCTION = "save_conditioning" FUNCTION = "save_conditioning"
CATEGORY = "CFZ/conditioning" CATEGORY = "CFZ Save-Load Conditioning"
def save_conditioning(self, conditioning, cache_name): def save_conditioning(self, conditioning, cache_name):
"""Save conditioning to cache with custom name, supporting subdirectories""" """Save conditioning to cache with custom name, supporting subdirectories"""
@ -148,7 +148,7 @@ class load_conditioning:
RETURN_TYPES = ("CONDITIONING",) RETURN_TYPES = ("CONDITIONING",)
RETURN_NAMES = ("conditioning",) RETURN_NAMES = ("conditioning",)
FUNCTION = "load_conditioning" FUNCTION = "load_conditioning"
CATEGORY = "CFZ/conditioning" CATEGORY = "CFZ Save-Load Conditioning"
@classmethod @classmethod
def get_cached_files(cls): def get_cached_files(cls):
@ -208,7 +208,7 @@ class load_conditioning:
file_path = self._resolve_path(file_path) file_path = self._resolve_path(file_path)
print(f"[CFZ Load] Loading conditioning from: {cache_name}") # print(f"[CFZ Load] Loading conditioning from: {cache_name}")
if not os.path.exists(file_path): if not os.path.exists(file_path):
raise ValueError(f"Cached conditioning not found: {cache_name}.pt") raise ValueError(f"Cached conditioning not found: {cache_name}.pt")
@ -260,6 +260,7 @@ class CFZ_PrintMarker:
"is_start_point": ("BOOLEAN", {"default": False}), "is_start_point": ("BOOLEAN", {"default": False}),
"is_end_point": ("BOOLEAN", {"default": False}), "is_end_point": ("BOOLEAN", {"default": False}),
"show_current_time": ("BOOLEAN", {"default": True}), "show_current_time": ("BOOLEAN", {"default": True}),
"clear_terminal": ("BOOLEAN", {"default": False}),
}, },
"optional": { "optional": {
"trigger": (any_type, {}), "trigger": (any_type, {}),
@ -271,10 +272,14 @@ class CFZ_PrintMarker:
RETURN_NAMES = ("output",) RETURN_NAMES = ("output",)
OUTPUT_NODE = True OUTPUT_NODE = True
FUNCTION = "run" FUNCTION = "run"
CATEGORY = "CFZ/utils/debug" CATEGORY = "CFZ Utils/Debug"
def run(self, message, timer_name="workflow_timer", is_start_point=False, is_end_point=False, def run(self, message, timer_name="workflow_timer", is_start_point=False, is_end_point=False,
show_current_time=True, trigger=None, unique_id=None, extra_pnginfo=None): show_current_time=True, clear_terminal=False, trigger=None, unique_id=None, extra_pnginfo=None):
# Clear terminal if requested (before any output)
if clear_terminal:
os.system('cls' if os.name == 'nt' else 'clear')
current_time = time.time() current_time = time.time()
current_timestamp = datetime.fromtimestamp(current_time).strftime("%H:%M:%S.%f")[:-3] current_timestamp = datetime.fromtimestamp(current_time).strftime("%H:%M:%S.%f")[:-3]