Marketplace, CSS, iCal and a lot of things... #4

Closed
valentin wants to merge 59 commits from dev into main
3 changed files with 143 additions and 134 deletions
Showing only changes of commit 9b9f5a162e - Show all commits

3
.gitignore vendored
View File

@ -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/

View File

@ -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,15 +22,7 @@ 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 = [
etudiants = [
["Aboujaib", "Alexandre", 4, "A", "Angl.", "All."],
["Ajan", "George", 4, "A", "Angl.", ""],
["Akrad", "Lina", 1, "SI", "Angl.", ""],
@ -75,9 +67,9 @@ def generate():
["Vié", "Adrien", 10, "B", "Angl.", "All."],
["Ye", "Luan", 10, "B", "Angl.", "All."],
["Zarka", "Amélie", 10, "B", "Angl.", "All."],
]
]
creneaux = [
creneaux = [
["Mathématiques", "vendredi", "17:00", "M. OUBAHA", "C382"],
["Anglais", "mercredi", "14:00", "Mme LE GOURIELLEC", "C393"],
["Mathématiques", "mercredi", "15:00", "M. BOULLY", "R004"],
@ -88,11 +80,11 @@ def generate():
["Physique", "mardi", "17:00", "M. COLIN", "C386"],
["Mathématiques", "mercredi", "13:30", "M. BOUVEROT", "??"],
["Anglais", "lundi", "13:00", "M. HERBAUT", "V052"],
]
]
semaines = list(range(24, 34))
semaines = list(range(24, 34))
rotations = [
rotations = [
# [semaine, groupe, creneau]
(24, 1, 1),
(24, 2, 2),
@ -100,17 +92,11 @@ def generate():
(27, 3, 3),
(28, 3, 3),
(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__":

BIN
test.pdf Normal file

Binary file not shown.