diff --git a/README.md b/README.md index 6667cb1..b1ff00a 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,13 @@ Show metadata, compare between two JSONs, compare between two images, show any v ## List > A set of nodes with list of values (any or strings/texts) -> With strings you can concatenate them +> With strings you can concatenate them ![Lists](./docs/lists.png) +> Important: You can use with others nodes like "Show any" to see the values of the list +![Lists](./docs/lists-any.png) + ## Switch > A set of nodes to switch between flows > All switches are boolean, you can switch between flows by simply changing the value of the switch. diff --git a/docs/lists-any.png b/docs/lists-any.png new file mode 100644 index 0000000..ca2a5e7 Binary files /dev/null and b/docs/lists-any.png differ diff --git a/nodes/debugger.py b/nodes/debugger.py index cf36dcf..2ade9d5 100644 --- a/nodes/debugger.py +++ b/nodes/debugger.py @@ -24,6 +24,8 @@ class CConsoleAny: } CATEGORY = CATEGORY.MAIN.value + CATEGORY.DEBUGGER.value + INPUT_IS_LIST = True + RETURN_TYPES = () OUTPUT_NODE = True @@ -35,7 +37,15 @@ class CConsoleAny: if any_value is not None: try: - text = str(any_value) + if type(any_value) == list: + for item in any_value: + try: + text += str(item) + "\n" + except Exception as e: + text += "source exists, but could not be serialized.\n" + logger.warn(e) + else: + text = str(any_value) except Exception: try: text = json.dumps(any_value)[1:-1] @@ -54,6 +64,6 @@ class CConsoleAny: textToDisplay = text value = [console, display, prefix, textToDisplay] - setWidgetValues(value, unique_id, extra_pnginfo) + # setWidgetValues(value, unique_id, extra_pnginfo) return {"ui": {"text": value}} diff --git a/nodes/list.py b/nodes/list.py index 326c81c..23c816a 100644 --- a/nodes/list.py +++ b/nodes/list.py @@ -1,4 +1,4 @@ -from ..core import STRING, TEXTS, KEYS, CATEGORY, any +from ..core import STRING, TEXTS, KEYS, CATEGORY, any, logger from ._names import CLASSES @@ -26,6 +26,7 @@ class CListAny: CATEGORY = CATEGORY.MAIN.value + CATEGORY.LIST.value RETURN_TYPES = (any,), RETURN_NAMES = ("any_list",) + OUTPUT_IS_LIST = (True,) FUNCTION = "execute" @@ -41,24 +42,48 @@ class CListAny: list = [] - if any_1: - list.append(any_1) - if any_2: - list.append(any_2) - if any_3: - list.append(any_3) - if any_4: - list.append(any_4) - if any_5: - list.append(any_5) - if any_6: - list.append(any_6) - if any_7: - list.append(any_7) - if any_8: - list.append(any_8) + if any_1 is not None: + try: + list.append(any_1) + except Exception as e: + logger.warn(e) + if any_2 is not None: + try: + list.append(any_2) + except Exception as e: + logger.warn(e) + if any_3 is not None: + try: + list.append(any_3) + except Exception as e: + logger.warn(e) + if any_4 is not None: + try: + list.append(any_4) + except Exception as e: + logger.warn(e) + if any_5 is not None: + try: + list.append(any_5) + except Exception as e: + logger.warn(e) + if any_6 is not None: + try: + list.append(any_6) + except Exception as e: + logger.warn(e) + if any_7 is not None: + try: + list.append(any_7) + except Exception as e: + logger.warn(e) + if any_8 is not None: + try: + list.append(any_8) + except Exception as e: + logger.warn(e) - return list + return [list] class CListString: @@ -102,21 +127,21 @@ class CListString: list = [] - if string_1: + if string_1 is not None: list.append(string_1) - if string_2: + if string_2 is not None: list.append(string_2) - if string_3: + if string_3 is not None: list.append(string_3) - if string_4: + if string_4 is not None: list.append(string_4) - if string_5: + if string_5 is not None: list.append(string_5) - if string_6: + if string_6 is not None: list.append(string_6) - if string_7: + if string_7 is not None: list.append(string_7) - if string_8: + if string_8 is not None: list.append(string_8) return delimiter.join(list), list diff --git a/nodes/utils.py b/nodes/utils.py index b278a81..ecec320 100644 --- a/nodes/utils.py +++ b/nodes/utils.py @@ -5,7 +5,7 @@ from ..core import CATEGORY, CONFIG, JSON_WIDGET, TEXTS, findJsonStrDiff, findJs class CMetadataExtractor: @classmethod - def INPUT_TYPES(s): + def INPUT_TYPES(cls): return { "required": { "metadata_raw": ("METADATA_RAW", {"forceInput": True}), @@ -65,7 +65,7 @@ class CMetadataExtractor: class CMetadataCompare: @classmethod - def INPUT_TYPES(s): + def INPUT_TYPES(cls): return { "required": { "metadata_raw_old": ("METADATA_RAW", {"forceInput": True}),