diff --git a/__init__.py b/__init__.py index 1e0b93d..919ab2f 100644 --- a/__init__.py +++ b/__init__.py @@ -32,6 +32,12 @@ if os.path.exists(wildcards_path): read_wildcard_dict(wildcards_path) else: os.mkdir(wildcards_path) +# Add custom wildcards example +example_path = os.path.join(wildcards_path, "example.txt") +if not os.path.exists(example_path): + with open(example_path, 'w') as f: + text = "blue\nred\nyellow\ngreen\nbrown\npink\npurple\norange\nblack\nwhite" + f.write(text) #Styles styles_path = os.path.join(os.path.dirname(__file__), "styles") @@ -43,6 +49,23 @@ else: os.mkdir(styles_path) os.mkdir(samples_path) +# Add custom styles example +example_path = os.path.join(styles_path, "your_styles.json.example") +if not os.path.exists(example_path): + import json + data = [ + { + "name": "Example Style", + "name_cn": "示例样式", + "prompt": "(masterpiece), (best quality), (ultra-detailed), {prompt} ", + "negative_prompt": "text, watermark, logo" + }, + ] + # Write to file + with open(example_path, 'w') as f: + json.dump(data, f, indent=4, ensure_ascii=False) + + # Model thumbnails from .py.libs.add_resources import add_static_resource from .py.libs.model import easyModelManager diff --git a/py/easyNodes.py b/py/easyNodes.py index 136b429..469086e 100644 --- a/py/easyNodes.py +++ b/py/easyNodes.py @@ -143,7 +143,7 @@ class stylesPromptSelector: styles_dir = FOOOCUS_STYLES_DIR for file_name in os.listdir(styles_dir): file = os.path.join(styles_dir, file_name) - if os.path.isfile(file) and file_name.endswith(".json") and "styles" in file_name.split(".")[0]: + if os.path.isfile(file) and file_name.endswith(".json"): styles.append(file_name.split(".")[0]) return { "required": {