feat: servicios WhatsApp, Bitácora WebControl, SQLite v4, UI y store listing
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
import os
|
||||
from PIL import Image, ImageDraw, ImageFont, ImageFilter
|
||||
|
||||
OUTPUT_DIR = "store_listing/graficos"
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
# Paleta oficial de la aplicación (theme.dart)
|
||||
COLOR_BG = (10, 14, 20) # #0A0E14 - surfaceLowest
|
||||
COLOR_CARD = (24, 28, 34) # #181C22 - surfaceLow
|
||||
COLOR_PRIMARY = (176, 198, 255) # #B0C6FF - primary
|
||||
COLOR_TEXT = (226, 232, 240) # #E2E8F0 - textMain
|
||||
COLOR_MUTED = (148, 163, 184) # #94A3B8 - textMuted
|
||||
COLOR_CONTAINER = (0, 35, 89) # #002359 - primaryContainer
|
||||
|
||||
logo_source = Image.open("lib/recursos/logo_app.png").convert("RGBA")
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# 1. ÍCONO DE TIENDA: 512x512 PNG sin transparencias
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
def generar_icono_512():
|
||||
size = (512, 512)
|
||||
# Fondo sólido sin transparencia (Requisito estricto de Google Play)
|
||||
canvas = Image.new("RGB", size, COLOR_BG)
|
||||
|
||||
# Rescalar logo con filtro Lanczos de alta calidad
|
||||
logo_size = 432
|
||||
logo_resized = logo_source.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
||||
|
||||
# Efecto de sutil resplandor azul detrás del logo
|
||||
glow = Image.new("RGBA", size, (0, 0, 0, 0))
|
||||
glow_draw = ImageDraw.Draw(glow)
|
||||
center = (256, 256)
|
||||
r = 210
|
||||
glow_draw.ellipse(
|
||||
[center[0] - r, center[1] - r, center[0] + r, center[1] + r],
|
||||
fill=(0, 35, 89, 120)
|
||||
)
|
||||
glow = glow.filter(ImageFilter.GaussianBlur(radius=20))
|
||||
|
||||
canvas_rgba = canvas.convert("RGBA")
|
||||
canvas_rgba.alpha_composite(glow)
|
||||
|
||||
# Centrar el logo
|
||||
pos = ((size[0] - logo_size) // 2, (size[1] - logo_size) // 2)
|
||||
canvas_rgba.alpha_composite(logo_resized, pos)
|
||||
|
||||
final_icon = canvas_rgba.convert("RGB")
|
||||
dest_path = os.path.join(OUTPUT_DIR, "00_icono_512.png")
|
||||
final_icon.save(dest_path, "PNG", optimize=True)
|
||||
# También como icono_512.png para compatibilidad
|
||||
final_icon.save(os.path.join(OUTPUT_DIR, "icono_512.png"), "PNG", optimize=True)
|
||||
print(f"✓ Ícono generado: {dest_path} (512x512 RGB)")
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# 2. GRÁFICO DESTACADO: 1024x500 PNG sin transparencias
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
def generar_grafico_destacado():
|
||||
width, height = 1024, 500
|
||||
canvas = Image.new("RGB", (width, height), COLOR_BG)
|
||||
draw = ImageDraw.Draw(canvas)
|
||||
|
||||
# Fondo con degradado y cuadrícula técnica de seguridad
|
||||
for y in range(height):
|
||||
ratio = y / height
|
||||
r = int(COLOR_BG[0] + (COLOR_CARD[0] - COLOR_BG[0]) * ratio)
|
||||
g = int(COLOR_BG[1] + (COLOR_CARD[1] - COLOR_BG[1]) * ratio)
|
||||
b = int(COLOR_BG[2] + (COLOR_CARD[2] - COLOR_BG[2]) * ratio)
|
||||
draw.line([(0, y), (width, y)], fill=(r, g, b))
|
||||
|
||||
# Cuadrícula sutil
|
||||
grid_color = (25, 32, 45)
|
||||
for x in range(0, width, 40):
|
||||
draw.line([(x, 0), (x, height)], fill=grid_color, width=1)
|
||||
for y in range(0, height, 40):
|
||||
draw.line([(0, y), (width, y)], fill=grid_color, width=1)
|
||||
|
||||
# Halo luminoso detrás del logo y títulos
|
||||
halo = Image.new("RGBA", (width, height), (0, 0, 0, 0))
|
||||
halo_draw = ImageDraw.Draw(halo)
|
||||
halo_draw.ellipse([80, 50, 480, 450], fill=(0, 35, 89, 140))
|
||||
halo_draw.ellipse([450, 100, 950, 400], fill=(20, 30, 55, 100))
|
||||
halo = halo.filter(ImageFilter.GaussianBlur(radius=40))
|
||||
|
||||
canvas_rgba = canvas.convert("RGBA")
|
||||
canvas_rgba.alpha_composite(halo)
|
||||
|
||||
# Logo a la izquierda (340x340)
|
||||
logo_size = 320
|
||||
logo_resized = logo_source.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
||||
canvas_rgba.alpha_composite(logo_resized, (70, (height - logo_size) // 2))
|
||||
|
||||
# Fuentes tipográficas
|
||||
font_paths = [
|
||||
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",
|
||||
"/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf",
|
||||
"/usr/share/fonts/truetype/freefont/FreeSansBold.ttf",
|
||||
]
|
||||
font_regular_paths = [
|
||||
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
|
||||
"/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf",
|
||||
"/usr/share/fonts/truetype/freefont/FreeSans.ttf",
|
||||
]
|
||||
|
||||
title_font = None
|
||||
for p in font_paths:
|
||||
if os.path.exists(p):
|
||||
title_font = ImageFont.truetype(p, 52)
|
||||
badge_font = ImageFont.truetype(p, 16)
|
||||
break
|
||||
if not title_font:
|
||||
title_font = ImageFont.load_default()
|
||||
badge_font = ImageFont.load_default()
|
||||
|
||||
sub_font = None
|
||||
for p in font_regular_paths:
|
||||
if os.path.exists(p):
|
||||
sub_font = ImageFont.truetype(p, 20)
|
||||
tag_font = ImageFont.truetype(p, 15)
|
||||
break
|
||||
if not sub_font:
|
||||
sub_font = ImageFont.load_default()
|
||||
tag_font = ImageFont.load_default()
|
||||
|
||||
text_draw = ImageDraw.Draw(canvas_rgba)
|
||||
|
||||
# Badge superior
|
||||
badge_x, badge_y = 430, 105
|
||||
badge_text = "SEGURIDAD ELECTRÓNICA & CONTROL"
|
||||
text_draw.rounded_rectangle([badge_x, badge_y, badge_x + 330, badge_y + 30], radius=15, fill=(0, 35, 89, 220), outline=COLOR_PRIMARY, width=1)
|
||||
text_draw.text((badge_x + 18, badge_y + 6), badge_text, font=badge_font, fill=COLOR_PRIMARY)
|
||||
|
||||
# Título principal
|
||||
text_draw.text((430, 150), "SENTINEL ONE", font=title_font, fill=(255, 255, 255))
|
||||
|
||||
# Subtítulo
|
||||
text_draw.text((430, 220), "Monitoreo Táctico y Control de Acceso", font=sub_font, fill=COLOR_PRIMARY)
|
||||
|
||||
# Puntos clave / features
|
||||
features = [
|
||||
"• Gestión de Alarmas e Incidentes en Tiempo Real",
|
||||
"• Control y Bloqueo Remoto de Puertas Físicas",
|
||||
"• Arquitectura Offline-First con Registro de Auditoría",
|
||||
"• Enlace Táctico y Protocolo de Pánico Inmediato"
|
||||
]
|
||||
fy = 270
|
||||
for feat in features:
|
||||
text_draw.text((430, fy), feat, font=tag_font, fill=COLOR_TEXT)
|
||||
fy += 32
|
||||
|
||||
final_graphic = canvas_rgba.convert("RGB")
|
||||
dest_path = os.path.join(OUTPUT_DIR, "grafico_destacado_1024x500.png")
|
||||
final_graphic.save(dest_path, "PNG", optimize=True)
|
||||
print(f"✓ Gráfico destacado generado: {dest_path} (1024x500 RGB)")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generar_icono_512()
|
||||
generar_grafico_destacado()
|
||||
Reference in New Issue
Block a user