From 68ee689fa33b95e8e0c3c8cc9a59cd98fae8c65a Mon Sep 17 00:00:00 2001 From: Tropfchen <6117944+Tropfchen@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:33:56 +0100 Subject: [PATCH] update js loading --- README.md | 2 +- __init__.py | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c0a3cd7..286aa1c 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ or To uninstall: -- Delete the `ComfyUI-yaResolutionSelector` in your ComfyUI custom_nodes directory and `yarsQuickNodes.js` file in `ComfyUI\web\extensions\tropf` directory +- Delete `ComfyUI-yaResolutionSelector` in your ComfyUI custom_nodes directory ## Use diff --git a/__init__.py b/__init__.py index df9df2e..c39b681 100644 --- a/__init__.py +++ b/__init__.py @@ -8,23 +8,17 @@ NODE_DISPLAY_NAME_MAPPINGS = { } -# --------------------------- Install web extension ---------------------------- -import shutil +# ------------------------ Remove copied web extension ------------------------- from pathlib import Path -# Get base paths node_dir = Path(__file__).resolve().parent comfy_dir = node_dir.parent.parent - -script_path = node_dir / "js" / "quickNodes.js" destination_dir = comfy_dir / "web" / "extensions" / "tropfchen" destination_path = destination_dir / "yarsQuickNodes.js" -try: - destination_dir.mkdir(parents=True, exist_ok=True) +if destination_path.exists(): + destination_path.unlink() - shutil.copy2(script_path, destination_path) -except PermissionError as permission_error: - print(f"Permission error: {permission_error}") -except Exception as e: - print(f"An unexpected error occurred: {e}") +# --------------------------- Install web extension ---------------------------- +WEB_DIRECTORY = "./js" +__all__ = ["WEB_DIRECTORY"]