-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__init__.py
98 lines (84 loc) · 3.62 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*- coding: utf-8 -*-
# Filename: __init__.py
# Developer: jammyfu
import os
import locale
from .modules.text.i18n import I18n
# 获取当前文件所在目录
EXTENSION_FOLDER = os.path.dirname(os.path.realpath(__file__))
# 导入所有非测试节点类
from .modules.images.mask_preview import MaskPreview
from .modules.images.image_resolution_creator import ImageSizeCreator
from .modules.images.image_resolution_creator import ImageLatentCreator
from .modules.images.dynamic_image_input import DynamicImageCombiner
from .modules.images.dynamic_mask_input import DynamicMaskCombiner
from .modules.images.image_resolution_adjuster import ImageResolutionAdjuster
from .modules.text.text_combiner import TextCombiner
from .modules.text.show_text_plus import ShowTextPlus
from .modules.text.simple_text_input import SimpleTextInput
from .modules.text.multiline_text_input import MultilineTextInput
from .modules.text.remove_empty_lines import RemoveEmptyLinesAndLeadingSpaces
from .modules.switch.switch_node import TextSwitch
from .modules.switch.switch_node import ImageSwitch
from .modules.switch.switch_node import MaskSwitch
from .modules.switch.switch_node import LatentSwitch
from .modules.web.web_image_loader import WebImageLoader
from .modules.images.image_base64_converter import ImageToBase64
# 节点类映射
NODE_CLASS_MAPPINGS = {
"MaskPreview": MaskPreview,
"ImageSizeCreator": ImageSizeCreator,
"ImageToBase64": ImageToBase64,
"ImageLatentCreator": ImageLatentCreator,
"DynamicImageCombiner": DynamicImageCombiner,
"DynamicMaskCombiner": DynamicMaskCombiner,
"ImageResolutionAdjuster": ImageResolutionAdjuster,
"TextCombiner": TextCombiner,
"ShowTextPlus": ShowTextPlus,
"SimpleTextInput": SimpleTextInput,
"MultilineTextInput": MultilineTextInput,
"RemoveEmptyLinesAndLeadingSpaces": RemoveEmptyLinesAndLeadingSpaces,
"PaintingCoder::TextSwitch": TextSwitch,
"PaintingCoder::ImageSwitch": ImageSwitch,
"PaintingCoder::MaskSwitch": MaskSwitch,
"PaintingCoder::LatentSwitch": LatentSwitch,
"WebImageLoader": WebImageLoader,
}
# 节点显示名称映射
NODE_DISPLAY_NAME_MAPPINGS = {
"MaskPreview": "Mask Preview 🎭",
"ImageSizeCreator": "Image Size Creator 📏",
"ImageToBase64": "Image To Base64 🎨",
"ImageLatentCreator": "Image Latent Creator 🎨",
"DynamicImageCombiner": "Dynamic Image Input 🖼️",
"DynamicMaskCombiner": "Dynamic Mask Input 🎭",
"ImageResolutionAdjuster": "Image Resolution Adjuster 📐",
"TextCombiner": "Text Combiner ✍️",
"ShowTextPlus": "Show Text Plus 📝",
"SimpleTextInput": "Simple Text Input 📝",
"MultilineTextInput": "Multiline Text Input 📝",
"RemoveEmptyLinesAndLeadingSpaces": "Remove Empty Lines And Leading Spaces 📝",
"PaintingCoder::TextSwitch": "Text Switch 🔄",
"PaintingCoder::ImageSwitch": "Image Switch 🔄",
"PaintingCoder::MaskSwitch": "Mask Switch 🔄",
"PaintingCoder::LatentSwitch": "Latent Switch 🔄",
"WebImageLoader": "Web Image Loader 🌐(URL Or Base64)",
}
# Web 目录配置
WEB_DIRECTORY = "./web"
print(f"Loading web directory from: {WEB_DIRECTORY}")
# 导出必要的变量
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
# 添加 Web 目录到 ComfyUI
def get_web_dirs():
return [WEB_DIRECTORY]
def init():
try:
# 获取系统语言设置
system_lang = locale.getdefaultlocale()[0]
if system_lang:
lang_code = system_lang.split('_')[0].lower()
I18n.set_language(lang_code)
except:
# 如果获取失败,默认使用英文
I18n.set_language('en')