Refactor initialization in __init__.py to include ColorPicker and update NODE_CLASS_MAPPINGS. Enhance README files with parameter settings and examples for text processing features. Update documentation to improve clarity and usability.
This commit is contained in:
@@ -86,6 +86,18 @@ Use Cases:
|
||||
- Preparing text for text-to-image generation
|
||||
- Standardizing text input format
|
||||
|
||||
Parameter Settings:
|
||||

|
||||
|
||||
Example with keep_single_empty_line=True:
|
||||

|
||||
|
||||
Example with preserve_indentation=True:
|
||||

|
||||
|
||||
Example with trim_trailing_spaces=True:
|
||||

|
||||
|
||||
## 📝 License
|
||||
|
||||
MIT License
|
||||
|
||||
@@ -86,6 +86,18 @@
|
||||
- 准备文生图的输入文本
|
||||
- 标准化文本输入格式
|
||||
|
||||
参数设置:
|
||||

|
||||
|
||||
保留单个空行的示例:
|
||||

|
||||
|
||||
保留缩进的示例:
|
||||

|
||||
|
||||
移除尾随空格的示例:
|
||||

|
||||
|
||||
## 📝 许可证
|
||||
|
||||
MIT License
|
||||
|
||||
+5
-6
@@ -4,21 +4,20 @@ setup()
|
||||
|
||||
try:
|
||||
from .image_resolution_adjuster import ImageResolutionAdjuster
|
||||
# 暂时注释掉未实现的节点
|
||||
# from .dynamic_image_input import DynamicImageInputs
|
||||
from .color_picker import ColorPicker
|
||||
from .remove_empty_lines import RemoveEmptyLinesAndLeadingSpaces
|
||||
|
||||
# 节点映射
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ImageResolutionAdjuster": ImageResolutionAdjuster,
|
||||
# "DynamicImageInputs": DynamicImageInputs,
|
||||
"RemoveEmptyLinesAndLeadingSpaces": RemoveEmptyLinesAndLeadingSpaces,
|
||||
"ColorPicker": ColorPicker,
|
||||
"RemoveEmptyLinesAndLeadingSpaces": RemoveEmptyLinesAndLeadingSpaces
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ImageResolutionAdjuster": "Image Resolution Adjuster",
|
||||
# "DynamicImageInputs": "Dynamic Image Inputs",
|
||||
"RemoveEmptyLinesAndLeadingSpaces": "Remove Empty Lines And LeadingSpaces",
|
||||
"ColorPicker": "Color Picker",
|
||||
"RemoveEmptyLinesAndLeadingSpaces": "Remove Empty Lines And Leading Spaces"
|
||||
}
|
||||
except ImportError as e:
|
||||
print(f"Error importing modules: {e}")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
import torch
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
class ColorPicker:
|
||||
"""
|
||||
颜色选择器节点,使用 jscolor 实现颜色选择和吸管工具
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.color = "#000000"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {}} # 不需要输入项
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("color",)
|
||||
FUNCTION = "pick_color"
|
||||
CATEGORY = "🎨Painting👓Coder/🎨Color"
|
||||
|
||||
def pick_color(self):
|
||||
return (self.color,)
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, **kwargs):
|
||||
return True
|
||||
|
||||
def widget_value_updated(self, widget, value):
|
||||
if widget.name == "color_picker":
|
||||
self.color = value
|
||||
|
||||
@classmethod
|
||||
def WIDGETS(s):
|
||||
return {"color_picker": ("color", {"default": "#000000"})}
|
||||
|
||||
# 在 __init__.py 中添加节点注册
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ColorPicker": ColorPicker
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ColorPicker": "Color Picker"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 257 KiB |
Reference in New Issue
Block a user