Skip to content

Commit

Permalink
refactor: update js loading
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed May 21, 2024
1 parent 969d14c commit 3f8a6ba
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
25 changes: 1 addition & 24 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions nodes/preview_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def preview_text(self, text):
"""
return {"ui": {"string": [text]}, "result": (text,)}

# WEB_DIRECTORY = "../web"

NODE_CLASS_MAPPINGS = {
"Captain__PreviewText": PreviewText
}
Expand Down
1 change: 1 addition & 0 deletions web/preview_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3f8a6ba

Please sign in to comment.