Files
LihonT/scripts/make_alpha_cards.py
cheb0chik 2907c99c44 LihonT 3 Luna alpha 1: the lock, the journal of entries and the front-camera picture
Lock for the whole app, every chat or chosen chats, opened by the phone's own fingerprint, face or lock-screen code. A journal of entries
(time, result, wrong fingers, chats opened) with optional front-camera pictures kept in a private folder, and a clear-all button.
Also: the mascot and the promo scripts for this release.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 15:11:30 +03:00

148 lines
6.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The cards for the post about LihonT 3 · Luna alpha 1 (the lock, the journal of entries and the picture of the thief): six 1080x1920 PNGs in
work/alpha-cards/, in the light style of the Store cards. The phone, the screens and the faces are the ones of the skit
(scripts/make_thief_video.py), the cat is the mascot (scripts/make_mascot.py). Everything is drawn here.
py -X utf8 -B scripts/make_alpha_cards.py
"""
from __future__ import annotations
import sys
from pathlib import Path
from PIL import Image
sys.path.insert(0, str(Path(__file__).resolve().parent))
import make_mascot as MC # noqa: E402
import make_store_cards as SC # noqa: E402
import make_store_video as V # noqa: E402
import make_thief_video as TH # noqa: E402
W, H, CX = SC.W, SC.H, SC.CX
INK, GREY, VIOLET = V.INK, V.GREY, V.VIOLET
OUT = V.ROOT / "work" / "alpha-cards"
BRAND = "LihonT 3 · Luna alpha 1"
RED = (214, 60, 70)
def footer(img):
flower = Image.open(V.ROOT / "src" / "brand" / "logo_note_flower_gold_1024.png").convert("RGBA").resize((86, 86), Image.Resampling.LANCZOS)
V.put_c(img, flower, CX - 230, H - 96)
V.text(img, (CX - 170, H - 94), BRAND + " · @lihont", 36, "semi", GREY, "lm")
def phone_card(img, key, cy=1090, scale=0.8, angle=0.0):
V.put_c(img, V.soft_shadow(380, 700, 60, blur=70, dy=50, alpha=50), CX, cy + 40)
V.put_c(img, TH.phone(key, False), CX, cy, scale, 1.0, angle)
def card_hero():
img = SC.canvas()
SC.petals(img, 31, 26, (60, 80, W - 60, H - 160), avoid=[(140, 360, 940, 1000)])
cat = MC.mascot(size=760)
V.put_c(img, V.soft_shadow(380, 120, 60, blur=50, dy=30, alpha=46), CX, 860)
V.put_c(img, cat, CX, 560)
V.text(img, (CX, 1000), "LihonT 3", 160, "semi", INK, "mm")
V.candy_text(img, CX, 1200, "ALPHA 1", 170, SC.LATE, 0.0, 0.0)
V.text(img, (CX, 1400), "блокировка и журнал входов", 52, "semi", INK, "mm")
V.text(img, (CX, 1470), "для твоего TikTok", 44, "reg", GREY, "mm")
V.pill(img, CX, 1590, "отпечаток · журнал · фото вора", VIOLET, (255, 255, 255), 36)
footer(img)
return img
def card_lock():
img = SC.canvas()
SC.head(img, "Закрой TikTok\nотпечатком", "тем же, которым открываешь телефон", y=200, size=92)
phone_card(img, ("lock", 0, "wait"), cy=1160, scale=0.82)
footer(img)
return img
def card_modes():
img = SC.canvas()
SC.head(img, "Что закрывать", "выбираешь сам", y=210)
rows = [("Весь TikTok", "открыл приложение, и сразу замок"), ("Все чаты", "каждый чат отдельно, у каждого свой замок"),
("Выбранные чаты", "только те, которые ты отметил")]
for i, (a, b) in enumerate(rows):
y = 640 + i * 290
V.put_c(img, V.card(900, 230, 54, blur=28, dy=14, alpha=44), CX, y)
V.put_c(img, V.disc(118, (255, 226, 238) if i == 0 else (222, 232, 255) if i == 1 else (226, 247, 232)), 210, y)
V.text(img, (210, y - 3), str(i + 1), 72, "black", INK, "mm")
V.text(img, (320, y - 34), a, 48, "bold", INK, "lm")
V.text(img, (320, y + 38), b, 30, "reg", GREY, "lm")
V.text(img, (CX, 1560), "Спрашивать снова", 40, "semi", INK, "mm")
for i, label in enumerate(["сразу", "1 мин", "5 мин", "15 мин"]):
V.pill(img, 190 + i * 233, 1650, label, (240, 240, 244), INK, 30)
footer(img)
return img
def card_journal():
img = SC.canvas()
SC.head(img, "Журнал входов", "кто пытался открыть и когда", y=200, size=100)
phone_card(img, ("journal", 10, ""), cy=1170, scale=0.82)
footer(img)
return img
def card_thief():
img = SC.canvas()
SC.petals(img, 33, 18, (40, 1500, W - 40, 1780), avoid=[(120, 1520, 960, 1740)])
SC.head(img, "Фото при каждом входе", "фронтальная камера снимает того, кто открывает", y=210, size=84)
photo = TH.face_photo("thief", 720)
mask = Image.new("L", photo.size, 0)
from PIL import ImageDraw
ImageDraw.Draw(mask).rounded_rectangle([0, 0, photo.width, photo.height], radius=64, fill=255)
photo = photo.copy()
photo.putalpha(mask)
V.put_c(img, V.card(720, 720, 64, blur=36, dy=20, alpha=56), CX, 900)
V.put_c(img, photo, CX, 900)
V.pill(img, CX, 1320, "03:12 · Не открыто · 2 неверных попытки", RED, (255, 255, 255), 34)
V.text(img, (CX, 1450), "Снимки только в закрытой папке мода,", 40, "reg", GREY, "mm")
V.text(img, (CX, 1510), "не в галерее. Одна кнопка стирает всё.", 40, "reg", GREY, "mm")
V.pill(img, CX, 1650, "Очистить всё", (240, 240, 244), INK, 40)
footer(img)
return img
def card_install():
img = SC.canvas()
SC.head(img, "Как получить", "это alpha: тестовая версия", y=210)
steps = [("Уже с LihonT 3?", "просто поверх, как обновление"), ("Новый?", "сначала удалите официальный TikTok"),
("Скачайте alpha 1", "git.lihont.space/lihont/LihonT")]
for n, (a, b) in enumerate(steps):
y = 640 + n * 290
V.put_c(img, V.card(900, 230, 54, blur=28, dy=14, alpha=44), CX, y)
V.put_c(img, V.disc(110, VIOLET), 210, y)
V.text(img, (210, y - 3), str(n + 1), 66, "bold", (255, 255, 255), "mm")
V.text(img, (310, y - 34), a, 44, "bold", INK, "lm")
V.text(img, (310, y + 38), b, 30, "reg", GREY, "lm")
V.put_c(img, MC.mascot(happy=True, size=380), CX, 1530)
V.text(img, (CX, 1730), "lihont.space · @lihont", 46, "semi", INK, "mm")
footer(img)
return img
CARDS = [("1_hero", card_hero), ("2_lock", card_lock), ("3_modes", card_modes), ("4_journal", card_journal), ("5_thief", card_thief),
("6_install", card_install)]
def main() -> None:
OUT.mkdir(parents=True, exist_ok=True)
for name, make in CARDS:
path = OUT / ("card_%s.png" % name)
make().convert("RGB").save(path)
print(path)
sheet = Image.new("RGB", (3 * 360 + 8, 2 * 640 + 4), (190, 190, 195))
for i, (name, _) in enumerate(CARDS):
sheet.paste(Image.open(OUT / ("card_%s.png" % name)).resize((360, 640), Image.Resampling.LANCZOS), ((i % 3) * 362, (i // 3) * 642))
sheet.save(OUT / "sheet.png")
if __name__ == "__main__":
main()