diff --git a/CLIPTextEncodeWildcards.py b/CLIPTextEncodeWildcards.py index fc9ad4f..e4296a7 100644 --- a/CLIPTextEncodeWildcards.py +++ b/CLIPTextEncodeWildcards.py @@ -8,12 +8,12 @@ if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__ else: from .ConsoleColor import print, console from .wildcards import wildcards -print(__file__) -print(os.path.basename(__file__)) +#print(__file__) +#print(os.path.basename(__file__)) -print("wildcards_ComfyUI") +#print("wildcards_ComfyUI") #print(os.getcwd()) -print(f"CLIPTextEncodeWildcards __name__ {__name__}") +#Wprint(f"CLIPTextEncodeWildcards __name__ {__name__}") class CLIPTextEncodeWildcards: @classmethod @@ -26,5 +26,5 @@ class CLIPTextEncodeWildcards: def encode(self, clip, text): r=wildcards.run(text) - print(f"encode : {r}") + print(f"[green]encode : [/green]",r) return ([[clip.encode(r), {}]], ) diff --git a/CheckpointLoaderSimpleText.py b/CheckpointLoaderSimpleText.py index cf6e1e9..18a4f11 100644 --- a/CheckpointLoaderSimpleText.py +++ b/CheckpointLoaderSimpleText.py @@ -9,8 +9,9 @@ if __name__ == os.path.splitext(os.path.basename(__file__))[0] : from ConsoleColor import print, console else: from .ConsoleColor import print, console -print(__file__) -print(os.path.basename(__file__)) + +#print(__file__) +#print(os.path.basename(__file__)) class CheckpointLoaderSimpleText: @classmethod diff --git a/ConsoleColor.py b/ConsoleColor.py index bf60e5e..3254b97 100644 --- a/ConsoleColor.py +++ b/ConsoleColor.py @@ -14,7 +14,11 @@ if missing: from rich.console import Console console=Console() print=console.log - +""" +print("test", style="bold white on blue") +print("test", style="bold green") +print("test", style="bold CYAN") +""" """ import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': diff --git a/__init__.py b/__init__.py index 41a673e..5d0b1cb 100644 --- a/__init__.py +++ b/__init__.py @@ -1,18 +1,14 @@ +import sys import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] : from ConsoleColor import print, console else: from .ConsoleColor import print, console -print(__file__) -print(os.path.basename(__file__)) +#print(__file__) +#print(os.path.basename(__file__)) - -import sys #print(f"sys.modules : {sys.modules}") -#mn=os.path.abspath(__main__) -#print("nm ", mn) - #filePath = __file__ #print("This script file path is ", filePath) # @@ -24,16 +20,17 @@ import sys # #path, filename = os.path.split(absFilePath) #print("Script file path is {}, filename is {}".format(path, filename)) - -nm=os.path.abspath(__name__) -print("abspath __name__ : ", nm) wd = os.getcwd() -print("working directory : ", wd) +#print("working directory : ", wd) + +nm=os.path.abspath(__name__) +#print("abspath __name__ : ", nm) md=nm.replace(wd+"\\","") -print("import name", md) - +#print("import name", md) +""" +""" #if md in sys.modules: # print(f"{md!r} already in sys.modules") #else: diff --git a/mypath.py b/mypath.py index 34a4811..0fb9cf7 100644 --- a/mypath.py +++ b/mypath.py @@ -1,11 +1,12 @@ import sys +import json import os if __name__ == os.path.splitext(os.path.basename(__file__))[0] : from ConsoleColor import print, console else: from .ConsoleColor import print, console -print(__file__) -print(os.path.basename(__file__)) +#print(__file__) +#print(os.path.basename(__file__)) """ @@ -48,3 +49,19 @@ print("mainFile : " + mainFile ,style="bold CYAN") mainfolder = os.path.dirname(mainFile) print("mainfolder : " + mainfolder , style="bold CYAN") +def jsondic(full,dic): + + path=os.path.split(full)[0] + if not os.path.exists(path): + os.makedirs(path) + #with open(f"./RandomLoop/chars-{time.strftime('_%Y%m%d_%H%M%S')}.json", 'w', encoding='utf-8') as file: + if os.path.exists(full): + with open(full, 'r', encoding='utf-8') as file: + dic=json.load(file) + #print(dic) + else: + with open(full, 'w', encoding='utf-8') as file: + json.dump(dic, file, sort_keys=False, indent=4) + + return path + \ No newline at end of file diff --git a/wildcards.py b/wildcards.py index c1b02d8..a17c07f 100644 --- a/wildcards.py +++ b/wildcards.py @@ -6,8 +6,8 @@ if __name__ == os.path.splitext(os.path.basename(__file__))[0] : from ConsoleColor import print, console else: from .ConsoleColor import print, console -print(__file__) -print(os.path.basename(__file__)) +#print(__file__) +#print(os.path.basename(__file__)) #print(os.getcwd()) # ============================================================ @@ -16,7 +16,7 @@ class wildcards: # 가져올 파일 목록 card_path=os.path.dirname(__file__)+"\\..\\..\\wildcards\\**\\*.txt" #card_path=f"{os.getcwd()}\\wildcards\\**\\*.txt" - print(f"wildcards card_path {card_path}") + print(f"wildcards card_path : ", card_path , style="bold CYAN") # 정규식 #resub = re.compile(r"(\{)([^\{\}]*)(\})") @@ -147,7 +147,7 @@ class wildcards: cards[file_name]+=[line] #print(f"line : {line}") wildcards.cards=cards - print(f"cards : {len(wildcards.cards)}") + print(f"[cyan]cards file count : [/cyan]", len(wildcards.cards)) #print(f"cards : {cards.keys()}") # 실행기 @@ -168,6 +168,6 @@ class wildcards: #if __name__ == '__main__' : # 테스트용 test="{3$$a1|{b2|c3|}|d4|{-$$|f|g}|{-2$$h||i}|{1-$$j|k|}}/{$$l|m|}/{0$$n|}" -print("wildcards test : "+wildcards.run(test)) +print("[green]wildcards test : [/green]",wildcards.run(test)) #print("wildcards test : "+wildcards.run("{9$$a|b}")) -print("wildcards test : "+wildcards.run("__my__")) +print("[green]wildcards test : [/green]",wildcards.run("__my__"))