1
This commit is contained in:
@@ -4,16 +4,19 @@ from nodes import *
|
||||
import folder_paths
|
||||
import random
|
||||
from .check_name import *
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
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__))
|
||||
|
||||
class CheckpointLoaderSimpleText:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
t_checkpoints=folder_paths.get_filename_list("checkpoints")
|
||||
#cprint(f"checkpoints count : {len(t_checkpoints)}", Colors.BGREEN)
|
||||
#print(f"checkpoints count : {len(t_checkpoints)}", Colors.BGREEN)
|
||||
return {
|
||||
"required": {
|
||||
"ckpt_name": (
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
|
||||
print(f"Colors __name__ {__name__}")
|
||||
|
||||
class Colors:
|
||||
BLACK = '\033[30m' #Colors.BLACK
|
||||
RED = '\033[31m' #Colors.BLACK
|
||||
GREEN = '\033[32m' #Colors.BLACK
|
||||
YELLOW = '\033[33m' #Colors.YELLOW
|
||||
BLUE = '\033[34m' #Colors.BLACK
|
||||
MAGENTA = '\033[35m' #Colors.BLACK
|
||||
CYAN = '\033[36m' #Colors.BLACK
|
||||
WHITE = '\033[37m' #Colors.BLACK
|
||||
BBLACK = '\033[90m' #Colors.BLACK
|
||||
BRED = '\033[91m' #Colors.BLACK
|
||||
BGREEN = '\033[92m' #Colors.BLACK
|
||||
BYELLOW = '\033[93m' #Colors.YELLOW
|
||||
BBLUE = '\033[94m' #Colors.BLACK
|
||||
BMAGENTA = '\033[95m' #Colors.BLACK
|
||||
BCYAN = '\033[96m' #Colors.BLACK
|
||||
BWHITE = '\033[97m' #Colors.BLACK
|
||||
UNDERLINE = '\033[4m' #Colors.BLACK
|
||||
RESET = '\033[0m' #Colors.BLACK
|
||||
|
||||
def cprint(text,color=None):
|
||||
if color:
|
||||
print(color + text + Colors.RESET)
|
||||
else:
|
||||
print(text)
|
||||
|
||||
#from Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
cprint("BLACK", Colors.BLACK)
|
||||
cprint("RED", Colors.RED)
|
||||
cprint("GREEN", Colors.GREEN)
|
||||
cprint("MAGENTA", Colors.MAGENTA)
|
||||
cprint("CYAN", Colors.CYAN)
|
||||
@@ -0,0 +1,41 @@
|
||||
import os, sys
|
||||
import sys
|
||||
import subprocess
|
||||
import pkg_resources
|
||||
|
||||
required = {'rich'}
|
||||
installed = {pkg.key for pkg in pkg_resources.working_set}
|
||||
missing = required - installed
|
||||
|
||||
if missing:
|
||||
python = sys.executable
|
||||
subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
console=Console()
|
||||
print=console.log
|
||||
print(
|
||||
{
|
||||
'test1':'tset',
|
||||
'test2':'tset',
|
||||
}
|
||||
)
|
||||
print("test", style="bold white on blue")
|
||||
"""
|
||||
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__))
|
||||
try:
|
||||
Exception_test()
|
||||
except Exception:
|
||||
#console.print_exception(show_locals=True)
|
||||
console.print_exception()
|
||||
+14
-11
@@ -6,16 +6,19 @@ import folder_paths
|
||||
class LoraLoaderText:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "model": ("MODEL",),
|
||||
"clip": ("CLIP", ),
|
||||
"lora_name": ("STRING", {
|
||||
"multiline": False, #True if you want the field to look like the one on the ClipTextEncode node
|
||||
"default": (folder_paths.get_filename_list("loras"), )
|
||||
}),
|
||||
#"lora_name": (folder_paths.get_filename_list("loras"), ),
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_clip": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
}}
|
||||
return {
|
||||
"required": {
|
||||
"model": ("MODEL",),
|
||||
"clip": ("CLIP", ),
|
||||
"lora_name": ("STRING", {
|
||||
"multiline": False, #True if you want the field to look like the one on the ClipTextEncode node
|
||||
"default": (folder_paths.get_filename_list("loras"), )
|
||||
}),
|
||||
#"lora_name": (folder_paths.get_filename_list("loras"), ),
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_clip": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("MODEL", "CLIP")
|
||||
FUNCTION = "load_lora"
|
||||
|
||||
@@ -45,7 +48,7 @@ class LoraLoaderText:
|
||||
return (model_lora, clip_lora)
|
||||
except Exception as e:
|
||||
print("LoraLoaderText Exception : "+ e)
|
||||
return (strength_model, strength_clip)
|
||||
return (model, clip)
|
||||
|
||||
#NODE_CLASS_MAPPINGS = {
|
||||
# "LoraLoaderText": LoraLoaderText,
|
||||
|
||||
@@ -21,7 +21,7 @@ class LoraLoaderTextRandom:
|
||||
"strength_model_min": ("FLOAT", {"default": 0.50, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_model_max": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_clip_min": ("FLOAT", {"default": 0.50, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_clip_max": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"strength_clip_max": ("FLOAT", {"default": 1.50, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("MODEL", "CLIP")
|
||||
|
||||
+13
-9
@@ -5,12 +5,16 @@ import json
|
||||
|
||||
import time
|
||||
|
||||
from .Colors import cprint, Colors
|
||||
import os, sys
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
import os
|
||||
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
|
||||
from ConsoleColor import print, console
|
||||
from mypath import *
|
||||
else:
|
||||
from .ConsoleColor import print, console
|
||||
from .mypath import *
|
||||
print(__file__)
|
||||
print(os.path.basename(__file__))
|
||||
|
||||
from .mypath import *
|
||||
|
||||
class SaveImageSimple:
|
||||
def __init__(self):
|
||||
@@ -37,9 +41,9 @@ class SaveImageSimple:
|
||||
def save_images(self, images, filename_prefix="", prompt=None, extra_pnginfo=None):
|
||||
|
||||
outputdir=os.path.join(mainfolder, "output")
|
||||
#cprint("outputdir : " + outputdir , Colors.CYAN)
|
||||
#print("outputdir : " + outputdir , Colors.CYAN)
|
||||
|
||||
#cprint("len(images) : " + str(len(images)) , Colors.CYAN)
|
||||
#print("len(images) : " + str(len(images)) , Colors.CYAN)
|
||||
filename_prefix+=time.strftime('_%Y%m%d_%H%M%S')
|
||||
results = list()
|
||||
cnt=1
|
||||
@@ -50,11 +54,11 @@ class SaveImageSimple:
|
||||
if prompt is not None:
|
||||
metadata.add_text("prompt", json.dumps(prompt))
|
||||
if extra_pnginfo is not None:
|
||||
#cprint("extra_pnginfo : " + json.dumps(extra_pnginfo) , Colors.CYAN)
|
||||
#print("extra_pnginfo : " + json.dumps(extra_pnginfo) , Colors.CYAN)
|
||||
for x in extra_pnginfo:
|
||||
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
||||
if not os.path.exists(outputdir):
|
||||
cprint("makedirs : " + outputdir , Colors.CYAN)
|
||||
print("makedirs : " + outputdir , Colors.CYAN)
|
||||
os.makedirs(outputdir)
|
||||
filename=filename_prefix+f"_{cnt:05}_.png"
|
||||
filename=os.path.join(outputdir, filename)
|
||||
|
||||
+8
-5
@@ -24,10 +24,13 @@ import numpy as np
|
||||
print(f"SimpleSampler __name__ {__name__}")
|
||||
print(f"SimpleSampler __file__ {os.path.splitext(os.path.basename(__file__))[0]}")
|
||||
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
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__))
|
||||
|
||||
#----------------------------
|
||||
# wildcards support check
|
||||
@@ -36,9 +39,9 @@ try:
|
||||
from wildcards import *
|
||||
wildcardsOn=True
|
||||
#wildcards.card_path=os.path.dirname(__file__)+"\\..\\wildcards\\**\\*.txt"
|
||||
cprint(f"{py_name} : import wildcards succ", Colors.GREEN )
|
||||
print(f"import wildcards succ", style="bold GREEN" )
|
||||
except:
|
||||
cprint(f"{py_name} : import wildcards fail", Colors.RED)
|
||||
print(f"import wildcards fail", style="bold RED")
|
||||
wildcardsOn=False
|
||||
err_msg = traceback.format_exc()
|
||||
print(err_msg)
|
||||
|
||||
+9
-15
@@ -1,15 +1,12 @@
|
||||
import os
|
||||
#from ComfyUI_script import mypath
|
||||
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(f"init __name__ {__name__}")
|
||||
print(f"init __file__ {os.path.splitext(os.path.basename(__file__))[0]}")
|
||||
|
||||
from .Colors import cprint, Colors as Colors
|
||||
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
import os
|
||||
import sys
|
||||
#print(f"sys.modules : {sys.modules}")
|
||||
|
||||
@@ -55,12 +52,9 @@ if not md.startswith("custom_nodes."):
|
||||
try:
|
||||
pkg = importlib.import_module(f"{md}.{name}")
|
||||
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
||||
cprint(f"Load ok : {name}")
|
||||
except Exception as e:
|
||||
cprint(f"Load fail : {name}",Colors.YELLOW)
|
||||
cprint(f"Exception : {e}",Colors.YELLOW)
|
||||
err_msg = traceback.format_exc()
|
||||
cprint(err_msg,Colors.YELLOW)
|
||||
print(f"Load ok : {name}", style="bold green")
|
||||
except Exception:
|
||||
console.print_exception()
|
||||
|
||||
add("CheckpointLoaderRandom")
|
||||
add("CheckpointLoaderSimpleText")
|
||||
|
||||
@@ -1,31 +1,50 @@
|
||||
import os, sys
|
||||
|
||||
import sys
|
||||
import os
|
||||
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
|
||||
from Colors import cprint, Colors as Colors
|
||||
from ConsoleColor import print, console
|
||||
else:
|
||||
from .Colors import cprint, Colors as Colors
|
||||
from .ConsoleColor import print, console
|
||||
print(__file__)
|
||||
print(os.path.basename(__file__))
|
||||
|
||||
|
||||
"""
|
||||
import psutil
|
||||
for proc in psutil.process_iter():
|
||||
ps_name = proc.name()
|
||||
if ps_name == 'python3':
|
||||
cmdline = proc.cmdline()
|
||||
print(cmdline)
|
||||
"""
|
||||
|
||||
"""
|
||||
print()
|
||||
for key, value in os.environ.items():
|
||||
print('{}: {}'.format(key, value))
|
||||
print()
|
||||
"""
|
||||
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
print(py_name, style="bold CYAN")
|
||||
|
||||
absFilePath = os.path.abspath(__file__)
|
||||
cprint("abspath : " + absFilePath , Colors.CYAN)
|
||||
print("abspath : " + absFilePath , style="bold CYAN")
|
||||
|
||||
realFilePath = os.path.realpath(__file__)
|
||||
cprint("realpath : " + realFilePath , Colors.CYAN)
|
||||
print("realpath : " + realFilePath , style="bold CYAN")
|
||||
|
||||
normpath=os.path.normpath(__file__)
|
||||
cprint("normpath : " + normpath , Colors.CYAN)
|
||||
print("normpath : " + normpath , style="bold CYAN")
|
||||
|
||||
subfolder = os.path.dirname(normpath)
|
||||
cprint("subfolder : " + subfolder , Colors.CYAN)
|
||||
print("subfolder : " + subfolder , style="bold CYAN")
|
||||
|
||||
filename = os.path.basename(normpath)
|
||||
cprint("filename : " + filename , Colors.CYAN)
|
||||
print("filename : " + filename , style="bold CYAN")
|
||||
|
||||
mainFile = os.path.abspath(sys.modules['__main__'].__file__)
|
||||
cprint("mainFile : " + mainFile , Colors.CYAN)
|
||||
print("mainFile : " + mainFile ,style="bold CYAN")
|
||||
|
||||
mainfolder = os.path.dirname(mainFile)
|
||||
cprint("mainfolder : " + mainfolder , Colors.CYAN)
|
||||
print("mainfolder : " + mainfolder , style="bold CYAN")
|
||||
|
||||
|
||||
+6
-11
@@ -2,17 +2,12 @@ import glob, sys
|
||||
import random
|
||||
import re
|
||||
import os
|
||||
|
||||
print(f"init __name__ {__name__}")
|
||||
print(f"init __file__ {os.path.splitext(os.path.basename(__file__))[0]}")
|
||||
|
||||
#import wildcards
|
||||
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
|
||||
from Colors import cprint, Colors as Colors
|
||||
from ConsoleColor import print, console
|
||||
else:
|
||||
from .Colors import cprint, Colors as Colors
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
from .ConsoleColor import print, console
|
||||
print(__file__)
|
||||
print(os.path.basename(__file__))
|
||||
#print(os.getcwd())
|
||||
|
||||
# ============================================================
|
||||
@@ -83,8 +78,8 @@ class wildcards:
|
||||
|
||||
|
||||
except Exception as e:
|
||||
cprint(f"Error : {match.groups()}" ,Colors.YELLOW)
|
||||
cprint(f"Exception : {e}" ,Colors.YELLOW)
|
||||
print(f"Error : {match.groups()}" ,Colors.YELLOW)
|
||||
print(f"Exception : {e}" ,Colors.YELLOW)
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user