- Реестр режимов постобработки вместо бинарного summary_mode: Чистая диктовка, Чистовик (без паразитов), Summary, Переводчик RU→EN, Промпт для LLM, Буллеты, Деловое письмо - Кастомные стили: свои промпты в настройках (таб «Стили») - Новая иконка приложения (микрофон + VД) - Прослушка звуков в настройках (кнопки ▶) - ffmpeg как опциональная докачка (кнопка в настройках), WAV-fallback без него - Версия 0.2.0 + changelog в «О программе» - Фикс: сохранение настроек через dataclasses.replace (не теряет поля) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
94 lines
2.8 KiB
Python
94 lines
2.8 KiB
Python
"""Генерирует .icns иконку приложения для macOS из микрофона."""
|
||
|
||
from __future__ import annotations
|
||
|
||
import shutil
|
||
import subprocess
|
||
import sys
|
||
import tempfile
|
||
from pathlib import Path
|
||
|
||
from PIL import Image, ImageDraw
|
||
|
||
# Размеры для iconset (macOS требует все эти варианты)
|
||
_ICON_SIZES = [16, 32, 64, 128, 256, 512, 1024]
|
||
|
||
|
||
def _make_app_icon(size: int) -> Image.Image:
|
||
"""Иконка приложения — микрофон в круге Flowmasters-цветов.
|
||
|
||
Args:
|
||
size: размер квадратной иконки в px.
|
||
|
||
Returns:
|
||
PIL Image RGBA size×size.
|
||
"""
|
||
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||
draw = ImageDraw.Draw(img)
|
||
|
||
# Фон — мягкий бронзово-зелёный круг (бренд Flowmasters)
|
||
bg_color = (52, 102, 90, 255)
|
||
margin = max(2, size // 32)
|
||
draw.ellipse((margin, margin, size - margin, size - margin), fill=bg_color)
|
||
|
||
# Микрофон белым
|
||
body_w = size // 3
|
||
body_h = int(size * 0.42)
|
||
cx = size // 2
|
||
body_top = size // 4
|
||
body_left = cx - body_w // 2
|
||
body_right = cx + body_w // 2
|
||
body_bottom = body_top + body_h
|
||
radius = body_w // 2
|
||
draw.rounded_rectangle(
|
||
(body_left, body_top, body_right, body_bottom),
|
||
radius=radius,
|
||
fill=(255, 255, 255, 255),
|
||
)
|
||
|
||
stem_y = body_bottom + size // 32
|
||
base_y = stem_y + size // 8
|
||
stroke = max(3, size // 32)
|
||
draw.line((cx, stem_y, cx, base_y), fill=(255, 255, 255, 255), width=stroke)
|
||
base_w = body_w
|
||
draw.line(
|
||
(cx - base_w // 2, base_y, cx + base_w // 2, base_y),
|
||
fill=(255, 255, 255, 255),
|
||
width=stroke,
|
||
)
|
||
|
||
return img
|
||
|
||
|
||
def main() -> int:
|
||
if not shutil.which("iconutil"):
|
||
print("iconutil не найден (нужен macOS).", file=sys.stderr)
|
||
return 1
|
||
|
||
project_root = Path(__file__).resolve().parent.parent
|
||
out_icns = project_root / "assets" / "icons" / "AppIcon.icns"
|
||
out_icns.parent.mkdir(parents=True, exist_ok=True)
|
||
|
||
with tempfile.TemporaryDirectory() as tmp:
|
||
iconset = Path(tmp) / "AppIcon.iconset"
|
||
iconset.mkdir()
|
||
|
||
for size in _ICON_SIZES:
|
||
img = _make_app_icon(size)
|
||
img.save(iconset / f"icon_{size}x{size}.png")
|
||
# Retina @2x варианты для размеров до 512
|
||
if size <= 512:
|
||
img2x = _make_app_icon(size * 2)
|
||
img2x.save(iconset / f"icon_{size}x{size}@2x.png")
|
||
|
||
subprocess.run(
|
||
["iconutil", "-c", "icns", str(iconset), "-o", str(out_icns)],
|
||
check=True,
|
||
)
|
||
|
||
print(f"Готово: {out_icns}")
|
||
return 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|