text
This commit is contained in:
Generated
+8
@@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ComfyUI_Text.iml" filepath="$PROJECT_DIR$/.idea/ComfyUI_Text.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
from .node import *
|
||||
from .install import *
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Show Text": ShowText
|
||||
}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS']
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
custom_nodes_path = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
def build_pip_install_cmds(args):
|
||||
if "python_embeded" in sys.executable or "python_embedded" in sys.executable:
|
||||
return [sys.executable, '-s', '-m', 'pip', 'install'] + args
|
||||
else:
|
||||
return [sys.executable, '-m', 'pip', 'install'] + args
|
||||
|
||||
def ensure_package():
|
||||
cmds = build_pip_install_cmds(['-r', 'requirements.txt'])
|
||||
subprocess.run(cmds, cwd=custom_nodes_path)
|
||||
|
||||
ensure_package()
|
||||
@@ -0,0 +1,108 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.append(
|
||||
os.path.dirname(os.path.abspath(__file__))
|
||||
)
|
||||
|
||||
class ShowText:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"text": ("STRING"),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "show_text"
|
||||
CATEGORY = "MK/text"
|
||||
|
||||
def show_text(self, text):
|
||||
return {"ui": {"text": [text,]}}
|
||||
|
||||
class CombinationText:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text1": ("STRING", {"multiline": True}),
|
||||
"text2": ("STRING", {"multiline": True}),
|
||||
"connector": ("STRING", {"default": ","}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("text",)
|
||||
|
||||
FUNCTION = "combination_text"
|
||||
|
||||
CATEGORY = "MK/text"
|
||||
|
||||
def combination_text(self, text1, text2, connector):
|
||||
texts = [text1, text2]
|
||||
combined_text = connector.join(texts)
|
||||
return (combined_text,)
|
||||
|
||||
class PlaceholderText:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text1": ("STRING", {"multiline": True}),
|
||||
"text2": ("STRING", {"multiline": True}),
|
||||
"placeholder": ("STRING", {"default": "$1,$2"}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("text",)
|
||||
|
||||
FUNCTION = "placeholder_text"
|
||||
|
||||
CATEGORY = "MK/text"
|
||||
|
||||
def placeholder_text(self, text1, text2, placeholder):
|
||||
replacements = {"$1": text1, "$2": text2}
|
||||
|
||||
for old, new in replacements.items():
|
||||
placeholder = placeholder.replace(old, new)
|
||||
|
||||
return (placeholder,)
|
||||
|
||||
|
||||
class ReplaceText:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text": ("STRING", {"multiline": True}),
|
||||
"old_string": ("STRING",),
|
||||
"new_string": ("STRING",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("text",)
|
||||
|
||||
FUNCTION = "replace_text"
|
||||
|
||||
CATEGORY = "MK/text"
|
||||
|
||||
def replace_text(self, text, old_string, new_string):
|
||||
|
||||
text = text.replace(old_string, new_string)
|
||||
|
||||
return (text,)
|
||||
Reference in New Issue
Block a user