1
0
forked from ScoDoc/ScoDoc

Bul. BUT: SAE dans synthèse, pied de bul. sur meme page.

This commit is contained in:
Emmanuel Viennet 2022-03-10 09:18:19 +01:00
parent 9587159692
commit 5efebb1336
3 changed files with 27 additions and 25 deletions

View File

@ -6,7 +6,7 @@
"""Génération bulletin BUT au format PDF standard
"""
import itertools
from reportlab.platypus import KeepInFrame, Paragraph, Spacer
from app.scodoc.sco_pdf import blue, cm, mm
@ -141,26 +141,27 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
],
}
rows.append(t)
# Liste chaque ressource
for mod_code, mod in ue["ressources"].items():
t = {
"titre": f"{mod_code} {self.infos['ressources'][mod_code]['titre']}",
"moyenne": mod["moyenne"],
"coef": mod["coef"],
"_coef_pdf": Paragraph(
f"<para align=right><i>{mod['coef']}</i></para>"
),
"_pdf_style": [
(
"LINEBELOW",
(0, 0),
(-1, 0),
self.PDF_LINEWIDTH,
(0.7, 0.7, 0.7), # gris clair
)
],
}
rows.append(t)
# Liste chaque ressource puis SAE
for mod_type in ("ressources", "saes"):
for mod_code, mod in ue[mod_type].items():
t = {
"titre": f"{mod_code} {self.infos[mod_type][mod_code]['titre']}",
"moyenne": mod["moyenne"],
"coef": mod["coef"],
"_coef_pdf": Paragraph(
f"<para align=right><i>{mod['coef']}</i></para>"
),
"_pdf_style": [
(
"LINEBELOW",
(0, 0),
(-1, 0),
self.PDF_LINEWIDTH,
(0.7, 0.7, 0.7), # gris clair
)
],
}
rows.append(t)
# Global pdf style commands:
pdf_style = [
("VALIGN", (0, 0), (-1, -1), "TOP"),

View File

@ -46,10 +46,11 @@ de la forme %(XXX)s sont remplacées par la valeur de XXX, pour XXX dans:
Balises img: actuellement interdites.
"""
from reportlab.platypus import KeepTogether, Paragraph, Spacer, Table
from reportlab.lib.units import cm, mm
from reportlab.lib.colors import Color, blue
import app.scodoc.sco_utils as scu
from app.scodoc.sco_pdf import Color, Paragraph, Spacer, Table
from app.scodoc.sco_pdf import blue, cm, mm
from app.scodoc.sco_pdf import SU
from app.scodoc import sco_preferences
from app.scodoc.sco_permissions import Permission
@ -195,7 +196,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
# -----
if format == "pdf":
return Op
return [KeepTogether(Op)]
elif format == "html":
return "\n".join(H)

View File

@ -124,7 +124,7 @@ def get_partition(partition_id):
{"partition_id": partition_id},
)
if not r:
raise ValueError("invalid partition_id (%s)" % partition_id)
raise ScoValueError(f"Partition inconnue (déjà supprimée ?) ({partition_id})")
return r[0]