From 3f8a6baaf139521848b779f883affe6d5cbf6e9d Mon Sep 17 00:00:00 2001 From: pixelass Date: Tue, 21 May 2024 19:30:33 +0200 Subject: [PATCH] refactor: update js loading --- __init__.py | 25 +------------------------ nodes/preview_text.py | 2 -- web/preview_text.js | 1 + 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/__init__.py b/__init__.py index 3904f38..f1de9e6 100644 --- a/__init__.py +++ b/__init__.py @@ -1,29 +1,5 @@ import importlib import os -import shutil -import folder_paths - -comfy_path = os.path.dirname(folder_paths.__file__) -captain_nodes_path = os.path.abspath(os.path.dirname(__file__)) - - -def setup_js(): - try: - js_dest_path = os.path.join(comfy_path, "web", "extensions", "ComfyUI-Captain-Nodes") - js_src_path = os.path.join(captain_nodes_path, "web") - print(js_src_path) - print(js_dest_path) - if os.path.exists(js_dest_path): - shutil.rmtree(js_dest_path) - - shutil.copytree(js_src_path, js_dest_path) - - except Exception as e: - print(f"An error occurred: {e}") - - -setup_js() - def do_install(): try: @@ -58,6 +34,7 @@ def do_install(): NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {} +WEB_DIRECTORY = "./web" for module_name in node_list: module_path = ".nodes." + module_name # Adjusted to include the subfolder diff --git a/nodes/preview_text.py b/nodes/preview_text.py index 3b148f5..d0a6895 100644 --- a/nodes/preview_text.py +++ b/nodes/preview_text.py @@ -43,8 +43,6 @@ def preview_text(self, text): """ return {"ui": {"string": [text]}, "result": (text,)} -# WEB_DIRECTORY = "../web" - NODE_CLASS_MAPPINGS = { "Captain__PreviewText": PreviewText } diff --git a/web/preview_text.js b/web/preview_text.js index 4bcfabd..159b398 100644 --- a/web/preview_text.js +++ b/web/preview_text.js @@ -2,6 +2,7 @@ import {app} from "/scripts/app.js"; import {ComfyWidgets} from "/scripts/widgets.js"; import {PREVIEW_TEXT_NODE_NAME} from "./constants.js"; +console.log(`Captain Node: ${PREVIEW_TEXT_NODE_NAME} extension loaded`) /** * Captain.previewText extension for enhancing the PreviewText node. * Adds custom string widget functionality for displaying output text.