"""Module 12 — Projet final.""" from outils import boite, fleche, toile from style import BLEU, ENCRE, GRIS, ORANGE, VERT, Figure def demarche_projet(): fig, ax = toile(16, 4.2) etapes = [("Besoin", "quel\nproblème ?", GRIS), ("Cahier des\ncharges", "matériel,\nmodules", BLEU), ("MVP", "l'indispensable\nd'abord", BLEU), ("Tests", "sur une durée\nréaliste", ORANGE), ("Bonus", "si le temps\nle permet", VERT), ("Présentation", "démo, choix,\ndifficultés", VERT)] xs = [1.3 + k * 2.68 for k in range(len(etapes))] for x, (nom, sous, c) in zip(xs, etapes): boite(ax, x, 2.6, 2.35, 1.1, nom, couleur=c, taille=7.2, gras=True) ax.text(x, 1.85, sous, ha="center", va="top", fontsize=7, color=GRIS) for a, b in zip(xs, xs[1:]): fleche(ax, (a + 1.175, 2.6), (b - 1.175, 2.6)) fleche(ax, (xs[3], 3.15), (xs[2], 3.15), "corriger", couleur=ORANGE, taille=7.3, courbe=0.6) return fig def structure_projet(): fig, ax = toile(16, 6.0) main = boite(ax, 8.0, 4.6, 6.2, 1.6, couleur=BLEU) ax.text(8.0, 5.05, "MonProjet.ino", ha="center", fontsize=9.5, fontweight="bold", color=BLEU, family="monospace") ax.text(8.0, 4.3, "setup() et loop() uniquement :\norchestrent les appels", ha="center", va="center", fontsize=7.8, color=ENCRE) onglets = [(2.8, "capteurs.ino", "lireTemperature()\nlireHumidite()", VERT), (8.0, "affichage.ino", "afficherEcran()\nafficherLed()", ORANGE), (13.2, "reseau.ino", "connecterWiFi()\npublierMQTT()", GRIS)] for x, nom, fonctions, c in onglets: boite(ax, x, 1.4, 4.2, 1.9, couleur=c) ax.text(x, 1.95, nom, ha="center", fontsize=9, fontweight="bold", color=c, family="monospace") ax.text(x, 1.1, fonctions, ha="center", va="center", fontsize=7.8, color=ENCRE, family="monospace") fleche(ax, (8.0 + (x - 8.0) * 0.25, main["b"][1]), (x, 2.35), couleur=c) ax.text(15.8, 5.6, "une fonction =\nune responsabilité", ha="right", fontsize=7.8, color=GRIS, style="italic") return fig FIGURES = [ Figure("m12-demarche-projet", demarche_projet), Figure("m12-structure-projet", structure_projet), ]