From 25e2a9c4bec3a18782069b90ed97fa86e444df37 Mon Sep 17 00:00:00 2001 From: Jose Gutierrez Date: Sun, 13 Aug 2023 14:34:55 +0200 Subject: [PATCH] - Removed ColorConsole to follow the same simple approach the majority of other ConfigUI nodes do - Removed extra verbose debugging console messages --- CLIPTextEncodeWildcards.py | 4 ++-- CheckpointLoaderSimpleText.py | 4 ++-- LoraLoaderText.py | 4 ++-- LoraLoaderTextRandom.py | 6 +++--- SaveImageSimple.py | 4 ++-- SimpleSampler.py | 4 ++-- TextWildcards.py | 4 ++-- VAELoaderText.py | 4 ++-- __init__.py | 34 ++++++++++++++++------------- mypath.py | 40 +++++++++++++++++------------------ wildcards.py | 11 +++++----- 11 files changed, 62 insertions(+), 57 deletions(-) diff --git a/CLIPTextEncodeWildcards.py b/CLIPTextEncodeWildcards.py index 0616381..a499dd8 100644 --- a/CLIPTextEncodeWildcards.py +++ b/CLIPTextEncodeWildcards.py @@ -3,10 +3,10 @@ import re import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': - from ConsoleColor import print, console + #from ConsoleColor import print, console from wildcards import wildcards else: - from .ConsoleColor import print, console + #from .ConsoleColor import print, console from .wildcards import wildcards #print(__file__) #print(os.path.basename(__file__)) diff --git a/CheckpointLoaderSimpleText.py b/CheckpointLoaderSimpleText.py index 3bdf13e..735f857 100644 --- a/CheckpointLoaderSimpleText.py +++ b/CheckpointLoaderSimpleText.py @@ -5,10 +5,10 @@ import random import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console, ccolor + #from ConsoleColor import print, console, ccolor from mypath import * else: - from .ConsoleColor import print, console, ccolor + #from .ConsoleColor import print, console, ccolor from .mypath import * #print(__file__) diff --git a/LoraLoaderText.py b/LoraLoaderText.py index 8ec23b4..af88b3d 100644 --- a/LoraLoaderText.py +++ b/LoraLoaderText.py @@ -4,10 +4,10 @@ import folder_paths if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console, ccolor + #from ConsoleColor import print, console, ccolor from mypath import * else: - from .ConsoleColor import print, console, ccolor + #from .ConsoleColor import print, console, ccolor from .mypath import * class LoraLoaderText: diff --git a/LoraLoaderTextRandom.py b/LoraLoaderTextRandom.py index 1f72df3..f048786 100644 --- a/LoraLoaderTextRandom.py +++ b/LoraLoaderTextRandom.py @@ -4,10 +4,10 @@ import folder_paths import random if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console + #from ConsoleColor import print, console from mypath import * else: - from .ConsoleColor import print, console + #from .ConsoleColor import print, console from .mypath import * class LoraLoaderTextRandom: @@ -82,7 +82,7 @@ def load_lora(self, model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora_path, strength_model, strength_clip) return (model_lora, clip_lora) except Exception as e: - console.print_exception() + print(f"An exception occurred:", e) return (model, clip) #NODE_CLASS_MAPPINGS = { diff --git a/SaveImageSimple.py b/SaveImageSimple.py index c8cecf6..d78828b 100644 --- a/SaveImageSimple.py +++ b/SaveImageSimple.py @@ -8,10 +8,10 @@ import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console + #from ConsoleColor import print, console from mypath import * else: - from .ConsoleColor import print, console + #from .ConsoleColor import print, console from .mypath import * #print(__file__) #print(os.path.basename(__file__)) diff --git a/SimpleSampler.py b/SimpleSampler.py index 54fd175..1a0605d 100644 --- a/SimpleSampler.py +++ b/SimpleSampler.py @@ -30,10 +30,10 @@ if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': - from ConsoleColor import print, console + #from ConsoleColor import print, console from wildcards import wildcards else: - from .ConsoleColor import print, console + #from .ConsoleColor import print, console from .wildcards import wildcards #print(__file__) #print(os.path.basename(__file__)) diff --git a/TextWildcards.py b/TextWildcards.py index 1b153c2..3c5daf1 100644 --- a/TextWildcards.py +++ b/TextWildcards.py @@ -3,10 +3,10 @@ import re import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': - from ConsoleColor import print, console + #from ConsoleColor import print, console from wildcards import wildcards else: - from .ConsoleColor import print, console + #from .ConsoleColor import print, console from .wildcards import wildcards diff --git a/VAELoaderText.py b/VAELoaderText.py index d695378..91f9a5d 100644 --- a/VAELoaderText.py +++ b/VAELoaderText.py @@ -3,10 +3,10 @@ import os from folder_paths import * if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console, ccolor + #from ConsoleColor import print, console, ccolor from mypath import * else: - from .ConsoleColor import print, console, ccolor + #from .ConsoleColor import print, console, ccolor from .mypath import * class VAELoaderText: diff --git a/__init__.py b/__init__.py index 1c31088..1780443 100644 --- a/__init__.py +++ b/__init__.py @@ -2,21 +2,21 @@ import os -print(f"__name__ : {__name__}") -print(f"__file__ : {__file__}") -print(f"os.path.basename(__file__) : {os.path.basename(__file__)}") -print(f"os.path.splitext(os.path.basename(__file__))[0] : {os.path.splitext(os.path.basename(__file__))[0]}") +#print(f"__name__ : {__name__}") +#print(f"__file__ : {__file__}") +#print(f"os.path.basename(__file__) : {os.path.basename(__file__)}") +#print(f"os.path.splitext(os.path.basename(__file__))[0] : {os.path.splitext(os.path.basename(__file__))[0]}") #print(f"os.path.basename(__file__) : {os.path.basename('/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_node_Lilly/__init__.py')}") #print(f"os.path.splitext(os.path.basename(__file__))[0] : {os.path.splitext(os.path.basename('/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_node_Lilly/__init__.py'))[0]}") -wd = os.getcwd() -print("working directory : ", wd) +#wd = os.getcwd() +#print("working directory : ", wd) -if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': - from ConsoleColor import print, console +#if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': + #from ConsoleColor import print, console #md="custom_nodes.ComfyUI_node_Lilly." -else: - from .ConsoleColor import print, console +#else: + #from .ConsoleColor import print, console #md="custom_nodes.ComfyUI_node_Lilly." md="custom_nodes.ComfyUI_node_Lilly." #print(__file__) @@ -80,11 +80,14 @@ def add(name,clist=None): for c in clist: NODE_CLASS_MAPPINGS[c]=eval(f"{md}{name}.{c}") - print(f"Load ok : {name}", style="bold green") - except Exception: - console.print_exception() + print(f"Load ok : {name}") + except Exception as e: + print(f"An exception occurred:", e) + #console.print_exception() - console.rule(f" init start ", style="bold green") + #console.rule(f" init start ", style="bold green") + #print(f" init start ") + print(f"### Loading: ComfyUI-node-Lilly") add("CheckpointLoaderRandom") add("CheckpointLoaderSimpleText") @@ -99,4 +102,5 @@ def add(name,clist=None): add("TextWildcards") #add("test") - console.rule(" init end ", style="bold green") \ No newline at end of file + #console.rule(" init end ", style="bold green") + #print(f" init end ") \ No newline at end of file diff --git a/mypath.py b/mypath.py index 673db2b..0a2e536 100644 --- a/mypath.py +++ b/mypath.py @@ -4,10 +4,10 @@ import os, glob import random from folder_paths import * -if __name__ == os.path.splitext(os.path.basename(__file__))[0] : - from ConsoleColor import print, console -else: - from .ConsoleColor import print, console +#if __name__ == os.path.splitext(os.path.basename(__file__))[0] : + #from ConsoleColor import print, console +#else: + #from .ConsoleColor import print, console """ import psutil @@ -25,28 +25,28 @@ print() """ -py_name=os.path.basename(__file__) -print("os.path.basename(__file__) : ",py_name, style="bold CYAN") +#py_name=os.path.basename(__file__) +#print("os.path.basename(__file__) : ",py_name, style="bold CYAN") -absFilePath = os.path.abspath(__file__) -print("os.path.abspath(__file__) : " , absFilePath , style="bold CYAN") +#absFilePath = os.path.abspath(__file__) +#print("os.path.abspath(__file__) : " , absFilePath , style="bold CYAN") -realFilePath = os.path.realpath(__file__) -print("os.path.abspath(__file__) : " + realFilePath , style="bold CYAN") +#realFilePath = os.path.realpath(__file__) +#print("os.path.abspath(__file__) : " + realFilePath , style="bold CYAN") -normpath=os.path.normpath(__file__) -print("os.path.normpath(__file__) : " + normpath , style="bold CYAN") +#normpath=os.path.normpath(__file__) +#print("os.path.normpath(__file__) : " + normpath , style="bold CYAN") -subfolder = os.path.dirname(normpath) -print("os.path.dirname(normpath) : " + subfolder , style="bold CYAN") +#subfolder = os.path.dirname(normpath) +#print("os.path.dirname(normpath) : " + subfolder , style="bold CYAN") -filename = os.path.basename(normpath) -print("os.path.basename(normpath) : " + filename , style="bold CYAN") +#filename = os.path.basename(normpath) +#print("os.path.basename(normpath) : " + filename , style="bold CYAN") -mainFile = os.path.abspath(sys.modules['__main__'].__file__) -print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN") -mainfolder = os.path.dirname(mainFile) -print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN") +#mainFile = os.path.abspath(sys.modules['__main__'].__file__) +#print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN") +#mainfolder = os.path.dirname(mainFile) +#print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN") def check_name(kind,name,supported_extensions): for ext in supported_extensions: diff --git a/wildcards.py b/wildcards.py index 00ab845..f2b3e21 100644 --- a/wildcards.py +++ b/wildcards.py @@ -5,10 +5,10 @@ import re import fnmatch -if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': - from ConsoleColor import print, console, ccolor -else: - from .ConsoleColor import print, console , ccolor +#if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': + #from ConsoleColor import print, console, ccolor +#else: + #from .ConsoleColor import print, console , ccolor #print(__file__) #print(os.path.basename(__file__)) #print(os.getcwd()) @@ -33,7 +33,8 @@ class wildcards: # 가져올 파일 목록 card_path = os.path.join(os.path.dirname(__file__), "..", "..", "wildcards", "**", "*.txt") #card_path=f"{os.getcwd()}\\wildcards\\**\\*.txt" - print(f"wildcards card_path : ", card_path , style="bold CYAN") + #print(f"wildcards card_path : ", card_path , style="bold CYAN") + print(f"wildcards card_path : ", card_path) # 정규식 #resub = re.compile(r"(\{)([^\{\}]*)(\})")