Sucre
This commit is contained in:
parent
970d74315b
commit
f414a434df
|
@ -158,5 +158,4 @@ cython_debug/
|
|||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
.idea/
|
||||
|
|
|
@ -4,16 +4,16 @@ from fpdf import FPDF
|
|||
from fpdf.fonts import FontFace
|
||||
from fpdf.enums import TableCellFillMode
|
||||
|
||||
sem_1 = date(2023, 9, 18)
|
||||
|
||||
vacances_zoneA = [
|
||||
calendrier_zoneC = date(2023, 9, 18), [
|
||||
( date(2023, 10, 21), date(2023, 11, 6) ),
|
||||
( date(2023, 12, 23), date(2024, 1, 8) ),
|
||||
( date(2024, 2, 10), date(2024, 2, 26) ),
|
||||
( date(2024, 4, 6), date(2024, 4, 22) ),
|
||||
]
|
||||
|
||||
def jour_of_sem(n, vac):
|
||||
def jour_of_sem(n, cal):
|
||||
sem_1, vac = cal
|
||||
|
||||
jour = sem_1 + (n-1) * timedelta(weeks=1)
|
||||
|
||||
for (debut, fin) in vac:
|
||||
|
@ -22,14 +22,6 @@ def jour_of_sem(n, vac):
|
|||
|
||||
return jour
|
||||
|
||||
def generate():
|
||||
pdf = FPDF(orientation="landscape", format="A4")
|
||||
pdf.set_font("helvetica", size=6)
|
||||
|
||||
pdf.set_title("Colloscope MP2I Semestre 5/2")
|
||||
pdf.set_author("Projet colloscope")
|
||||
pdf.set_author("Projet colloscope")
|
||||
|
||||
etudiants = [
|
||||
["Aboujaib", "Alexandre", 4, "A", "Angl.", "All."],
|
||||
["Ajan", "George", 4, "A", "Angl.", ""],
|
||||
|
@ -102,15 +94,9 @@ def generate():
|
|||
(31, 3, 3),
|
||||
]
|
||||
|
||||
pdf.add_page()
|
||||
|
||||
pdf.cell(text="Colloscope MP2I Semestre 5/2", center=True, border=1, h=5)
|
||||
|
||||
base_y = pdf.t_margin + 10
|
||||
|
||||
pdf.set_y(base_y)
|
||||
|
||||
with pdf.table(
|
||||
class PDF(FPDF):
|
||||
def liste_eleves(self, etudiants):
|
||||
with self.table(
|
||||
align="RIGHT",
|
||||
col_widths=(50, 35, 12, 12, 12, 12),
|
||||
width=80,
|
||||
|
@ -128,9 +114,9 @@ def generate():
|
|||
row.cell(etu[4]) # LV1
|
||||
row.cell(etu[5]) # LV2
|
||||
|
||||
pdf.set_y(base_y)
|
||||
|
||||
with pdf.table(
|
||||
def table_colloscope(self, creneaux, semaines, rotations):
|
||||
with self.table(
|
||||
align="LEFT",
|
||||
width=190,
|
||||
line_height=3,
|
||||
|
@ -146,7 +132,7 @@ def generate():
|
|||
|
||||
header2 = table.row()
|
||||
for sem in semaines:
|
||||
header2.cell(jour_of_sem(sem, vacances_zoneA).strftime("%d/%m/%y"), align="CENTER")
|
||||
header2.cell(jour_of_sem(sem, calendrier_zoneC).strftime("%d/%m/%y"), align="CENTER")
|
||||
|
||||
for i, tr in enumerate(creneaux):
|
||||
matiere, jour, heure, colleur, salle = tr
|
||||
|
@ -166,6 +152,30 @@ def generate():
|
|||
else:
|
||||
row.cell()
|
||||
|
||||
|
||||
|
||||
def generate():
|
||||
pdf = PDF(orientation="landscape", format="a4")
|
||||
pdf.set_font("helvetica", size=6)
|
||||
|
||||
pdf.set_title("colloscope mp2i semestre 5/2")
|
||||
pdf.set_author("projet colloscope")
|
||||
pdf.set_author("projet colloscope")
|
||||
|
||||
pdf.add_page()
|
||||
|
||||
pdf.cell(text="Colloscope MP2I Semestre 5/2", center=True, border=1, h=5)
|
||||
|
||||
base_y = pdf.t_margin + 10
|
||||
|
||||
pdf.set_y(base_y)
|
||||
|
||||
pdf.liste_eleves(etudiants)
|
||||
|
||||
pdf.set_y(base_y)
|
||||
|
||||
pdf.table_colloscope(creneaux, semaines, rotations)
|
||||
|
||||
pdf.output("test.pdf")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue