- 新增 PosterSmartEngine,AI 生成文案 + 海报渲染 - 5 种布局支持文本换行和自适应字体 - 修复按钮/标签颜色显示问题 - 优化渐变遮罩和内容区域计算 - Prompt 优化:标题格式为产品名+描述
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""布局模块"""
|
|
|
|
from .base import BaseLayout
|
|
from .hero_bottom import HeroBottomLayout
|
|
from .overlay_center import OverlayCenterLayout
|
|
from .overlay_bottom import OverlayBottomLayout
|
|
from .split_vertical import SplitVerticalLayout
|
|
from .card_float import CardFloatLayout
|
|
|
|
# 布局注册表
|
|
LAYOUTS = {
|
|
"hero_bottom": HeroBottomLayout,
|
|
"overlay_center": OverlayCenterLayout,
|
|
"overlay_bottom": OverlayBottomLayout,
|
|
"split_vertical": SplitVerticalLayout,
|
|
"card_float": CardFloatLayout,
|
|
}
|
|
|
|
# 布局别名
|
|
LAYOUT_ALIASES = {
|
|
"景点": "hero_bottom",
|
|
"攻略": "overlay_center",
|
|
"美食": "overlay_bottom",
|
|
"探店": "overlay_bottom",
|
|
"酒店": "card_float",
|
|
"民宿": "split_vertical",
|
|
}
|
|
|
|
|
|
def get_layout(name: str) -> type:
|
|
"""获取布局类"""
|
|
# 先检查别名
|
|
if name in LAYOUT_ALIASES:
|
|
name = LAYOUT_ALIASES[name]
|
|
return LAYOUTS.get(name, HeroBottomLayout)
|
|
|
|
|
|
__all__ = [
|
|
'BaseLayout',
|
|
'HeroBottomLayout',
|
|
'OverlayCenterLayout',
|
|
'OverlayBottomLayout',
|
|
'SplitVerticalLayout',
|
|
'CardFloatLayout',
|
|
'LAYOUTS',
|
|
'LAYOUT_ALIASES',
|
|
'get_layout',
|
|
]
|