-
Notifications
You must be signed in to change notification settings - Fork 4
/
__init__.py
61 lines (47 loc) · 1.69 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
@author: Zichen LIU (https://zliucz.github.io/) and Yue YU (https://bruceyyu.github.io/)
@title: MagicQuill
@nickname: MagicQuill nodes
@description: Official ComfyUI Implementations for Paper - MagicQuill: An Intelligent Interactive Image Editing System
"""
import os
import importlib.util
import subprocess
import sys
import shutil
import __main__
import pkgutil
import re
import threading
python = sys.executable
from .magic_quill import MagicQuill
extension_folder = os.path.dirname(os.path.realpath(__file__))
folder_web = os.path.join(os.path.dirname(os.path.realpath(__main__.__file__)), "web")
folder_comfyui_web_extensions = os.path.join(folder_web, "extensions")
folder__web_lib = os.path.join(folder_web, "lib")
NODE_CLASS_MAPPINGS = {
"MagicQuill": MagicQuill,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"MagicQuill": "MagicQuill",
}
web_dir = "web_dir"
WEB_DIRECTORY = os.path.join(".", web_dir)
def installNodes():
print(f"\n-------> MagicQuill Node Installing [DEBUG] <-------")
web_extensions_dir = os.path.join(extension_folder, web_dir)
# Clear old dir folder
if os.path.exists(web_extensions_dir):
shutil.rmtree(web_extensions_dir)
extensions_dirs_copy = ["js", "assets", "lib"]
for dir_name in extensions_dirs_copy:
folder_curr = os.path.join(extension_folder, dir_name)
if os.path.exists(folder_curr):
folder_curr_dist = os.path.join(
web_extensions_dir,
dir_name,
"" if dir_name != "js" else web_extensions_dir,
)
shutil.copytree(folder_curr, folder_curr_dist, dirs_exist_ok=True)
print(f"\n-------> MagicQuill Node Installed [DEBUG] <-------")
installNodes()