Bandeau Beta, bouton Donner mon avis (texte + capture), libelles SIMULE, fusion des donnees de demo (bots), formulaire web et PDF a la charte, plan de deploiement non applique. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
133 lignes
7.0 KiB
Python
133 lignes
7.0 KiB
Python
"""Génère le formulaire testeur PDF (champs AcroForm) à la charte JobRunner.
|
|
|
|
python beta/pdf/generer_formulaire.py
|
|
Dépendances (locales, hors dépôt) : reportlab, fonttools, brotli.
|
|
Sortie : beta/static/pdf/formulaire-testeur-jobrunner.pdf
|
|
La police Chillax (woff2 du dépôt) est convertie en TTF temporaire (beta/pdf/*.ttf, ignoré par git).
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from fontTools.ttLib import TTFont
|
|
from reportlab.lib.colors import HexColor
|
|
from reportlab.lib.pagesizes import A4
|
|
from reportlab.pdfbase import pdfmetrics
|
|
from reportlab.pdfbase.ttfonts import TTFont as RLFont
|
|
from reportlab.pdfgen import canvas
|
|
|
|
ICI = Path(__file__).resolve().parent
|
|
RACINE = ICI.parent.parent
|
|
SORTIE = ICI.parent / "static" / "pdf" / "formulaire-testeur-jobrunner.pdf"
|
|
FOND, SAUGE, TEXTE, CHAIR, FILET, DOUX = (HexColor(x) for x in ("#F2F0E6", "#8B9E90", "#2D2D2D", "#E8D5C4", "#E0DDD5", "#6B6B6B"))
|
|
|
|
|
|
def police(poids, nom):
|
|
ttf = ICI / f"chillax-{poids}.ttf"
|
|
if not ttf.exists():
|
|
f = TTFont(str(RACINE / "assets" / "fonts" / f"chillax-latin-{poids}-normal.woff2"))
|
|
f.flavor = None
|
|
f.save(str(ttf))
|
|
pdfmetrics.registerFont(RLFont(nom, str(ttf)))
|
|
|
|
|
|
def main():
|
|
police(400, "Chillax"); police(700, "Chillax-Bold")
|
|
SORTIE.parent.mkdir(parents=True, exist_ok=True)
|
|
c = canvas.Canvas(str(SORTIE), pagesize=A4, pageCompression=1)
|
|
c.setTitle("Formulaire testeur - JobRunner bêta"); c.setAuthor("JobRunner"); c.setSubject("Participation à la bêta de test")
|
|
W, Hh = A4
|
|
M = 46
|
|
f = c.acroForm
|
|
|
|
def fond():
|
|
c.setFillColor(FOND); c.rect(0, 0, W, Hh, stroke=0, fill=1)
|
|
|
|
def champ(nom, x, y, w, tip, h=22):
|
|
f.textfield(name=nom, tooltip=tip, x=x, y=y, width=w, height=h, borderStyle="solid", borderWidth=1,
|
|
borderColor=SAUGE, fillColor=HexColor("#FFFFFF"), textColor=TEXTE, forceBorder=True,
|
|
fontName="Helvetica", fontSize=11)
|
|
|
|
def case(nom, x, y, tip):
|
|
f.checkbox(name=nom, tooltip=tip, x=x, y=y, size=14, borderColor=SAUGE, fillColor=HexColor("#FFFFFF"),
|
|
textColor=TEXTE, forceBorder=True, buttonStyle="check", checked=False)
|
|
|
|
def texte(t, x, y, fonte="Chillax", taille=10.5, couleur=TEXTE):
|
|
c.setFont(fonte, taille); c.setFillColor(couleur); c.drawString(x, y, t)
|
|
|
|
def para(lignes, x, y, taille=9.5, inter=13):
|
|
for l in lignes:
|
|
texte(l, x, y, taille=taille); y -= inter
|
|
return y
|
|
|
|
# ---------- Page 1 ----------
|
|
fond()
|
|
c.drawImage(str(RACINE / "assets" / "img" / "logo.png"), M, Hh - 100, width=56, height=56, mask="auto")
|
|
texte("Formulaire testeur", M + 70, Hh - 70, "Chillax-Bold", 24)
|
|
texte("Bêta de test de JobRunner · à remplir à l'écran ou à imprimer", M + 70, Hh - 88, taille=10, couleur=DOUX)
|
|
c.setFillColor(SAUGE); c.roundRect(W - M - 90, Hh - 76, 90, 22, 11, stroke=0, fill=1)
|
|
texte("BÊTA", W - M - 62, Hh - 69, "Chillax-Bold", 11, FOND)
|
|
|
|
c.setFillColor(CHAIR); c.roundRect(M, Hh - 170, W - 2 * M, 52, 12, stroke=0, fill=1)
|
|
para(["Vous testez une version d'essai : tout est fictif, aucun paiement n'est réel (paiement SIMULÉ).",
|
|
"Contrepartie envisagée : suivre JobRunner sur les réseaux et, sous réserve de confirmation par",
|
|
"JobRunner, 1 an de Pass premium. Ce n'est pas encore une promesse ferme."], M + 12, Hh - 135, 9.5)
|
|
|
|
y = Hh - 210
|
|
texte("1. Vos coordonnées", M, y, "Chillax-Bold", 14); y -= 46
|
|
moitie = (W - 2 * M - 14) / 2
|
|
texte("Prénom", M, y + 26, taille=9.5, couleur=DOUX); champ("prenom", M, y, moitie, "Prénom")
|
|
texte("Nom", M + moitie + 14, y + 26, taille=9.5, couleur=DOUX); champ("nom", M + moitie + 14, y, moitie, "Nom")
|
|
y -= 50
|
|
texte("E-mail", M, y + 26, taille=9.5, couleur=DOUX); champ("email", M, y, moitie, "Adresse e-mail")
|
|
texte("Téléphone", M + moitie + 14, y + 26, taille=9.5, couleur=DOUX); champ("tel", M + moitie + 14, y, moitie, "Téléphone")
|
|
y -= 50
|
|
texte("Date de naissance (JJ/MM/AAAA)", M, y + 26, taille=9.5, couleur=DOUX); champ("naissance", M, y, moitie, "Date de naissance")
|
|
y -= 36
|
|
texte("2. Âge et accord parental", M, y, "Chillax-Bold", 14); y -= 22
|
|
case("age_15_ou_plus", M, y - 2, "J'ai 15 ans ou plus")
|
|
y = para(["J'ai 15 ans ou plus (participation impossible en dessous)."], M + 24, y + 1)
|
|
y -= 12
|
|
para(["Si j'ai entre 15 et 17 ans, le responsable légal remplit les trois champs ci-dessous :"], M, y, 9.5); y -= 52
|
|
texte("Nom et prénom du responsable légal", M, y + 26, taille=9.5, couleur=DOUX); champ("parent_nom", M, y, moitie, "Responsable légal")
|
|
texte("E-mail du responsable légal", M + moitie + 14, y + 26, taille=9.5, couleur=DOUX); champ("parent_email", M + moitie + 14, y, moitie, "E-mail du responsable légal")
|
|
y -= 30
|
|
case("accord_parental", M, y - 2, "Accord parental")
|
|
y = para(["Je suis le responsable légal et j'autorise ce mineur à participer à la bêta."], M + 24, y + 1)
|
|
|
|
y -= 30
|
|
texte("3. Engagements (à cocher)", M, y, "Chillax-Bold", 14); y -= 24
|
|
blocs = [("accord_participation", "Accord de participation",
|
|
["J'accepte de participer à la bêta de JobRunner à titre bénévole, de donner mon avis",
|
|
"(ce qu'il faut garder ou changer) et je peux arrêter à tout moment."]),
|
|
("confidentialite", "Confidentialité de la bêta",
|
|
["Je garde la bêta confidentielle : pas de capture, de vidéo ni de description publique",
|
|
"sans l'accord de JobRunner. Mon code d'accès est personnel."]),
|
|
("rgpd", "Consentement RGPD minimal",
|
|
["J'accepte que JobRunner conserve ces informations uniquement pour gérer la bêta (accès,",
|
|
"contact, contrepartie). Pas de vente ni de transmission ; suppression sur simple demande",
|
|
"et au plus tard 6 mois après la fin de la bêta."]),
|
|
("suivi_reseaux", "Facultatif : réseaux sociaux",
|
|
["Je m'engage à suivre JobRunner sur les réseaux sociaux (comptes indiqués à l'envoi du code)."])]
|
|
for nom, titre, lignes in blocs:
|
|
case(nom, M, y - 2, titre)
|
|
texte(titre, M + 24, y, "Chillax-Bold", 10.5)
|
|
y = para(lignes, M + 24, y - 13, 9) - 8
|
|
|
|
y -= 6
|
|
texte("4. Signature", M, y, "Chillax-Bold", 14); y -= 46
|
|
texte("Fait à", M, y + 26, taille=9.5, couleur=DOUX); champ("lieu", M, y, moitie, "Lieu")
|
|
texte("Le (JJ/MM/AAAA)", M + moitie + 14, y + 26, taille=9.5, couleur=DOUX); champ("date_signature", M + moitie + 14, y, moitie, "Date")
|
|
y -= 50
|
|
texte("Signature (nom, ou signature manuscrite après impression) :", M, y + 26, taille=9.5, couleur=DOUX)
|
|
champ("signature", M, y - 12, W - 2 * M, "Signature", h=34)
|
|
|
|
c.setStrokeColor(FILET); c.line(M, 50, W - M, 50)
|
|
texte("À renvoyer à contact@jobrunner.fr · JobRunner bêta : version d'essai, données fictives, paiements simulés.", M, 34, taille=8.5, couleur=DOUX)
|
|
c.showPage()
|
|
c.save()
|
|
print("PDF écrit :", SORTIE, SORTIE.stat().st_size, "octets")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|