PRESETS = { "cinematic": { "categories": ["lighting", "composition", "effects", "style"], "label_en": "Cinematic", "label_ru": "Кино", "icon": "🎬", "description_en": "Dramatic lighting, deep composition, film effects", "description_ru": "Драматическое освещение, глубокая композиция, киноэффекты", "bundle_tags": ["cinematic lighting", "depth of field", "film grain", "bokeh"], }, "dreamy": { "categories": ["atmosphere", "lighting", "colors", "effects"], "label_en": "Dreamy", "label_ru": "Мечта", "icon": "🌸", "description_en": "Soft atmosphere, pastel colors, dreamy haze", "description_ru": "Мягкая атмосфера, пастельные цвета, мечтательная дымка", "bundle_tags": ["dreamy", "soft focus", "pastel colors", "haze"], }, "vibrant": { "categories": ["colors", "lighting", "special_fx", "style"], "label_en": "Vibrant", "label_ru": "Яркий", "icon": "✨", "description_en": "Bold colors, dynamic lighting, magical effects", "description_ru": "Яркие цвета, динамичное освещение, магические эффекты", "bundle_tags": ["vibrant colors", "flat color", "thick outlines", "bold"], }, "natural": { "categories": ["quality", "background", "pose", "expression"], "label_en": "Natural", "label_ru": "Натуральный", "icon": "🌿", "description_en": "High quality, natural poses, genuine expressions", "description_ru": "Высокое качество, естественные позы, живые выражения", "bundle_tags": ["natural lighting", "realistic", "natural pose"], }, "dramatic": { "categories": ["lighting", "effects", "composition", "atmosphere"], "label_en": "Dramatic", "label_ru": "Драма", "icon": "⚡", "description_en": "High contrast, moody atmosphere, intense effects", "description_ru": "Высокий контраст, мрачная атмосфера, интенсивные эффекты", "bundle_tags": ["dramatic lighting", "high contrast", "intense"], }, "kawaii": { "categories": ["expression", "clothing", "colors", "special_fx"], "label_en": "Kawaii", "label_ru": "Кавай", "icon": "💖", "description_en": "Cute expressions, pastel outfits, sparkly effects", "description_ru": "Милые выражения, пастельные наряды, блестящие эффекты", "bundle_tags": ["kawaii", "cute", "pastel", "sparkle"], }, "gothic": { "categories": ["atmosphere", "lighting", "style", "background"], "label_en": "Gothic", "label_ru": "Готика", "icon": "🦇", "description_en": "Dark atmosphere, dramatic shadows, gothic architecture", "description_ru": "Тёмная атмосфера, драматичные тени, готическая архитектура", "bundle_tags": ["gothic", "dark", "gloom", "cross"], }, "cyberpunk": { "categories": ["style", "effects", "lighting", "colors"], "label_en": "Cyberpunk", "label_ru": "Киберпанк", "icon": "🌃", "description_en": "Neon lights, futuristic city, cyber aesthetics", "description_ru": "Неоновые огни, футуристический город, кибер эстетика", "bundle_tags": ["cyberpunk", "neon", "futuristic", "hologram"], }, "watercolor": { "categories": ["style", "colors", "atmosphere", "effects"], "label_en": "Watercolor", "label_ru": "Акварель", "icon": "🎨", "description_en": "Soft watercolor style, flowing colors, artistic feel", "description_ru": "Мягкий акварельный стиль, плавные цвета, художественное ощущение", "bundle_tags": ["watercolor", "painting", "soft colors", "artistic"], }, "portrait": { "categories": ["quality", "expression", "lighting", "framing"], "label_en": "Portrait", "label_ru": "Портрет", "icon": "🧑", "description_en": "Detailed face, perfect anatomy, studio lighting", "description_ru": "Детализированное лицо, идеальная анатомия, студийное освещение", "bundle_tags": ["portrait", "detailed face", "perfect anatomy", "studio lighting"], }, "landscape": { "categories": ["background", "atmosphere", "lighting", "colors"], "label_en": "Landscape", "label_ru": "Пейзаж", "icon": "🏔️", "description_en": "Beautiful scenery, atmospheric lighting, nature", "description_ru": "Красивый пейзаж, атмосферное освещение, природа", "bundle_tags": ["scenery", "wide shot", "landscape", "detailed background"], }, "mecha": { "categories": ["style", "effects", "composition", "special_fx"], "label_en": "Mecha", "label_ru": "Меха", "icon": "🤖", "description_en": "Detailed mecha, dynamic poses, futuristic tech", "description_ru": "Детализированные меха, динамичные позы, футуристические технологии", "bundle_tags": ["mecha", "robot", "armor", "futuristic"], }, "fantasy": { "categories": ["atmosphere", "special_fx", "clothing", "background", "accessory"], "label_en": "Fantasy", "label_ru": "Фэнтези", "icon": "🧙", "description_en": "Magical atmosphere, fantasy creatures, enchanted world", "description_ru": "Магическая атмосфера, фэнтези существа, зачарованный мир", "bundle_tags": ["magic", "crystal", "glowing"], }, "noir": { "categories": ["lighting", "style", "atmosphere", "composition"], "label_en": "Noir", "label_ru": "Нуар", "icon": "🕵️", "description_en": "Black and white, high contrast, film noir style", "description_ru": "Чёрно-белое, высокий контраст, стиль нуар", "bundle_tags": ["noir", "monochrome", "high contrast", "shadow"], }, "sakura": { "categories": ["atmosphere", "colors", "background", "expression"], "label_en": "Sakura", "label_ru": "Сакура", "icon": "🌺", "description_en": "Cherry blossoms, soft pink tones, spring atmosphere", "description_ru": "Сакура, мягкие розовые тона, весенняя атмосфера", "bundle_tags": ["sakura", "cherry blossoms", "pink flowers", "petals"], }, "underwater": { "categories": ["background", "effects", "atmosphere", "colors"], "label_en": "Underwater", "label_ru": "Подводный", "icon": "🐠", "description_en": "Underwater scene, light rays, marine atmosphere", "description_ru": "Подводная сцена, лучи света, морская атмосфера", "bundle_tags": ["underwater", "bubbles", "light rays", "blue tones"], }, "space": { "categories": ["background", "effects", "atmosphere", "special_fx"], "label_en": "Space", "label_ru": "Космос", "icon": "🚀", "description_en": "Starfield, nebula, cosmic atmosphere", "description_ru": "Звёздное небо, туманность, космическая атмосфера", "bundle_tags": ["space", "stars", "nebula", "cosmic"], }, "detailed_art": { "categories": ["quality", "style", "effects", "composition"], "label_en": "Detailed Art", "label_ru": "Детализированное", "icon": "🔍", "description_en": "Maximum detail, intricate patterns, masterful rendering", "description_ru": "Максимальная детализация, сложные узоры, мастерская отрисовка", "bundle_tags": ["highres", "absurdres", "incredibly absurdres", "detailed"], }, "moe_blobs": { "categories": ["expression", "clothing", "colors", "atmosphere"], "label_en": "Moe Blobs", "label_ru": "Моэ", "icon": "💕", "description_en": "Extra cute, soft colors, adorable expressions", "description_ru": "Очаровательно, мягкие цвета, милые выражения", "bundle_tags": ["moe", "chibi", "big eyes", "soft"], }, "warrior": { "categories": ["pose", "lighting", "composition", "clothing", "weapon"], "label_en": "Warrior", "label_ru": "Воин", "icon": "⚔️", "description_en": "Dynamic action pose, dramatic lighting, battle-ready", "description_ru": "Динамичная боевая поза, драматичное освещение, готовность к бою", "bundle_tags": ["armor", "sword", "cape"], }, "retro": { "categories": ["style", "effects", "colors", "atmosphere"], "label_en": "Retro", "label_ru": "Ретро", "icon": "📻", "description_en": "Vintage retro style with film grain and warm nostalgic colors", "description_ru": "Винтажный ретро-стиль с фильм-грейном и тёплыми ностальгическими цветами", "bundle_tags": ["retro", "film grain", "vintage", "warm colors"], }, "steampunk": { "categories": ["style", "lighting", "background", "special_fx", "accessory"], "label_en": "Steampunk", "label_ru": "Стимпанк", "icon": "⚙️", "description_en": "Brass gears, steam tech and Victorian sci-fi atmosphere", "description_ru": "Латунные шестерёнки, паровые технологии и викторианская sci-fi атмосфера", "bundle_tags": ["goggles", "clockwork", "brass"], }, "magical_girl": { "categories": ["special_fx", "clothing", "expression", "colors", "accessory"], "label_en": "Magical Girl", "label_ru": "Девочка-волшебница", "icon": "💫", "description_en": "Sparkles, magical outfits, transformation effects and cute expressions", "description_ru": "Блёстки, волшебные наряды, эффекты трансформации и милые выражения", "bundle_tags": ["sparkle", "magic", "ribbon"], }, "horror": { "categories": ["atmosphere", "lighting", "effects", "expression"], "label_en": "Horror", "label_ru": "Хоррор", "icon": "👻", "description_en": "Dark scary atmosphere, harsh lighting and frightening expressions", "description_ru": "Тёмная страшная атмосфера, жёсткое освещение и пугающие выражения", "bundle_tags": ["horror", "dark", "scary", "harsh lighting"], }, "winter": { "categories": ["background", "atmosphere", "colors", "clothing"], "label_en": "Winter", "label_ru": "Зима", "icon": "❄️", "description_en": "Snowy landscapes, cold colors and warm winter clothing", "description_ru": "Снежные пейзажи, холодные цвета и тёплая зимняя одежда", "bundle_tags": ["snow", "winter", "cold colors", "winter clothes"], }, "summer": { "categories": ["background", "atmosphere", "pose", "colors"], "label_en": "Summer", "label_ru": "Лето", "icon": "☀️", "description_en": "Bright sunny scenes, beach or meadow backgrounds and vibrant colors", "description_ru": "Яркие солнечные сцены, пляж или луг на фоне и насыщенные цвета", "bundle_tags": ["sunlight", "summer", "bright", "beach"], }, "angelic": { "categories": ["angelic", "lighting", "atmosphere", "quality"], "label_en": "Angelic", "label_ru": "Ангельский", "icon": "👼", "description_en": "Holy ethereal glow, soft divine lighting and pure atmosphere", "description_ru": "Священное эфирное сияние, мягкое божественное освещение и чистая атмосфера", "bundle_tags": ["angelic", "holy", "glow", "divine light"], }, "slice_of_life": { "categories": ["background", "pose", "expression", "atmosphere"], "label_en": "Slice of Life", "label_ru": "Повседневность", "icon": "☕", "description_en": "Casual everyday scenes with natural poses and warm mood", "description_ru": "Повседневные сцены с естественными позами и тёплым настроением", "bundle_tags": ["casual", "everyday", "warm mood", "natural pose"], }, "action": { "categories": ["pose", "composition", "special_fx", "effects"], "label_en": "Action", "label_ru": "Экшн", "icon": "💥", "description_en": "Dynamic movement, speed lines, impact sparks and energetic poses", "description_ru": "Динамичное движение, линии скорости, искры удара и энергичные позы", "bundle_tags": ["action", "dynamic pose", "speed lines", "impact"], }, "romantic": { "categories": ["atmosphere", "lighting", "expression", "colors"], "label_en": "Romantic", "label_ru": "Романтика", "icon": "💘", "description_en": "Soft romantic lighting, tender expressions and warm colors", "description_ru": "Мягкое романтическое освещение, нежные выражения и тёплые цвета", "bundle_tags": ["romantic", "soft lighting", "warm colors", "tender"], }, "demon": { "categories": ["demon", "atmosphere", "lighting", "expression"], "label_en": "Demon", "label_ru": "Демон", "icon": "👿", "description_en": "Dark infernal aura, fiery effects and menacing expressions", "description_ru": "Тёмная преисподняя аура, огненные эффекты и угрожающие выражения", "bundle_tags": ["demon", "dark aura", "fire", "menacing"], }, "fantasy_creature": { "categories": ["animal", "atmosphere", "background", "special_fx"], "label_en": "Fantasy Creature", "label_ru": "Фэнтези-создание", "icon": "🐉", "description_en": "Mythical beasts, magical habitats and creature effects", "description_ru": "Мифические звери, волшебные места обитания и эффекты существ", "bundle_tags": ["mythical creature", "magical", "fantasy", "creature"], }, "pirate": { "categories": ["clothing", "weapon", "background", "atmosphere", "vehicle", "effects"], "label_en": "Pirate / Nautical", "label_ru": "Пират / Море", "icon": "🏴‍☠️", "description_en": "Swashbuckling adventure, naval gear, ocean backgrounds", "description_ru": "Приключения, морская амуниция, океанские фоны", "bundle_tags": ["bandana", "sword", "ship"], }, "sci_fi": { "categories": ["vehicle", "weapon", "clothing", "effects", "style", "lighting"], "label_en": "Sci-Fi Commander", "label_ru": "Научная фантастика", "icon": "🚀", "description_en": "Futuristic gear, energy weapons, neon and hologram effects", "description_ru": "Футуристическая экипировка, энергетическое оружие, неон и голограммы", "bundle_tags": ["neon", "hologram", "suit"], }, "medieval": { "categories": ["architecture", "weapon", "clothing", "atmosphere", "style", "lighting"], "label_en": "Medieval / Renaissance", "label_ru": "Средневековье", "icon": "🏰", "description_en": "Castles, knights, royal attire and torchlit atmosphere", "description_ru": "Замки, рыцари, королевские одежды и атмосфера факелов", "bundle_tags": ["armor", "sword", "cape"], }, "mecha_pilot": { "categories": ["vehicle", "weapon", "pose", "composition", "effects", "style"], "label_en": "Mecha Pilot", "label_ru": "Пилот меха", "icon": "🤖", "description_en": "Cockpit view, pilot suits, giant robot controls", "description_ru": "Вид из кабины, костюмы пилота, управление гигантскими роботами", "bundle_tags": ["goggles", "suit", "mecha"], }, "maid_cafe": { "categories": ["food", "clothing", "expression", "atmosphere", "colors", "accessory"], "label_en": "Maid Cafe", "label_ru": "Мейд-кафе", "icon": "☕", "description_en": "Maid outfits, cafe setting, sweet treats and warm colors", "description_ru": "Формы горничных, кафе, десерты и тёплые цвета", "bundle_tags": ["maid headdress", "apron", "coffee"], }, "holiday": { "categories": ["season", "clothing", "atmosphere", "object", "special_fx", "colors"], "label_en": "Holiday / Christmas", "label_ru": "Праздник", "icon": "🎄", "description_en": "Festive decorations, holiday outfits, seasonal atmosphere", "description_ru": "Праздничные украшения, наряды, сезонная атмосфера", "bundle_tags": ["santa hat", "christmas", "snow"], }, "furry_anthro": { "categories": ["furry", "animal", "clothing", "expression", "atmosphere", "accessory"], "label_en": "Furry / Anthro", "label_ru": "Фурри", "icon": "🐺", "description_en": "Anthro characters, animal ears, fluffy tails, feral expressions", "description_ru": "Антропоморфные персонажи, уши, хвосты, звериные выражения", "bundle_tags": ["furry", "tail", "animal ears"], }, "school": { "categories": ["clothing", "expression", "pose", "background", "atmosphere", "accessory"], "label_en": "School / Uniform", "label_ru": "Школа", "icon": "📚", "description_en": "School uniforms, classroom settings, youthful expressions", "description_ru": "Школьная форма, классы, юные выражения", "bundle_tags": ["school uniform", "book", "ribbon"], }, } def get_preset_categories(preset_name: str) -> list[str]: preset = get_all_presets().get(preset_name) if isinstance(preset, dict): return list(preset.get("categories", [])) return [] def get_preset_bundle_tags(preset_name: str) -> list[str]: preset = get_all_presets().get(preset_name) if isinstance(preset, list): return list(preset) if isinstance(preset, dict) and "bundle_tags" in preset: return list(preset["bundle_tags"]) return [] def get_preset_names() -> list[str]: return list(get_all_presets().keys()) PRESET_GROUPS = [ {"key": "style", "icon": "🎨", "label_en": "Style & Art", "label_ru": "Стиль и искусство", "presets": ["cinematic", "dreamy", "vibrant", "natural", "dramatic", "watercolor", "detailed_art", "retro"]}, {"key": "dark", "icon": "🌙", "label_en": "Dark & Moody", "label_ru": "Тёмное настроение", "presets": ["gothic", "noir", "horror", "demon"]}, {"key": "future", "icon": "🚀", "label_en": "Futuristic", "label_ru": "Футуристическое", "presets": ["cyberpunk", "mecha", "sci_fi", "mecha_pilot"]}, {"key": "fantasy", "icon": "🧙", "label_en": "Fantasy & Magic", "label_ru": "Фэнтези и магия", "presets": ["fantasy", "magical_girl", "angelic", "fantasy_creature"]}, {"key": "nature", "icon": "🏞️", "label_en": "Nature & Season", "label_ru": "Природа и сезон", "presets": ["landscape", "winter", "summer", "sakura", "underwater", "space"]}, {"key": "char", "icon": "😊", "label_en": "Character", "label_ru": "Персонаж", "presets": ["kawaii", "portrait", "moe_blobs", "slice_of_life", "romantic"]}, {"key": "action", "icon": "⚔️", "label_en": "Action & Adventure", "label_ru": "Экшн и приключения", "presets": ["warrior", "action", "pirate", "medieval"]}, {"key": "theme", "icon": "🎭", "label_en": "Theme & Culture", "label_ru": "Тема и культура", "presets": ["steampunk", "maid_cafe", "holiday", "furry_anthro", "school"]}, ] import os as _os import json as _json _USER_PRESETS_PATH = _os.path.join(_os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))), "data", "user_presets.json") def load_user_presets() -> dict: """Load user-saved named tag bundles (E). Returns {name: [tags]}.""" try: with open(_USER_PRESETS_PATH, "r", encoding="utf-8") as fh: data = _json.load(fh) if isinstance(data, dict): return {str(k): list(v) for k, v in data.items()} except (FileNotFoundError, _json.JSONDecodeError, OSError): pass return {} def save_user_presets(data: dict) -> None: try: _os.makedirs(_os.path.dirname(_USER_PRESETS_PATH), exist_ok=True) with open(_USER_PRESETS_PATH, "w", encoding="utf-8") as fh: _json.dump(data, fh, ensure_ascii=False, indent=2) except OSError: pass def save_user_preset(name: str, tags: list[str]) -> dict: name = (name or "").strip() tags = [t.strip() for t in (tags or []) if t and t.strip()] data = load_user_presets() if name: data[name] = tags save_user_presets(data) return data def delete_user_preset(name: str) -> dict: data = load_user_presets() data.pop(name, None) save_user_presets(data) return data def get_all_presets() -> dict: """Base PRESETS merged with user-saved presets.""" merged = dict(PRESETS) merged.update(load_user_presets()) return merged def get_user_preset_names() -> list[str]: return list(load_user_presets().keys())