forked from ScoDoc/DocScoDoc
Bul. BUT PDF: débuts sur pages impaires
This commit is contained in:
parent
0c1c6de7bc
commit
e0a3c31f9c
@ -23,7 +23,8 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
|
||||
"""
|
||||
|
||||
list_in_menu = False # spécialisation du BulletinGeneratorStandard, ne pas présenter à l'utilisateur
|
||||
scale_table_in_page = False
|
||||
scale_table_in_page = False # pas de mise à l'échelle pleine page auto
|
||||
multi_pages = True # plusieurs pages par bulletins
|
||||
small_fontsize = "8"
|
||||
|
||||
def bul_table(self, format="html"):
|
||||
|
@ -49,7 +49,14 @@ import traceback
|
||||
|
||||
|
||||
import reportlab
|
||||
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak
|
||||
from reportlab.platypus import (
|
||||
SimpleDocTemplate,
|
||||
DocIf,
|
||||
Paragraph,
|
||||
Spacer,
|
||||
Frame,
|
||||
PageBreak,
|
||||
)
|
||||
from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
|
||||
|
||||
from flask import request
|
||||
@ -72,6 +79,7 @@ class BulletinGenerator:
|
||||
description = "superclass for bulletins" # description for user interface
|
||||
list_in_menu = True # la classe doit-elle est montrée dans le menu de config ?
|
||||
scale_table_in_page = True # rescale la table sur 1 page
|
||||
multi_pages = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -157,28 +165,35 @@ class BulletinGenerator:
|
||||
marque_debut_bulletin = sco_pdf.DebutBulletin(
|
||||
self.infos["etud"]["nomprenom"], filigranne=self.infos["filigranne"]
|
||||
)
|
||||
objects = []
|
||||
story = []
|
||||
# partie haute du bulletin
|
||||
objects += self.bul_title_pdf() # pylint: disable=no-member
|
||||
index_obj_debut = len(objects)
|
||||
story += self.bul_title_pdf() # pylint: disable=no-member
|
||||
index_obj_debut = len(story)
|
||||
|
||||
# table des notes
|
||||
objects += self.bul_table(format="pdf") # pylint: disable=no-member
|
||||
story += self.bul_table(format="pdf") # pylint: disable=no-member
|
||||
# infos sous la table
|
||||
objects += self.bul_part_below(format="pdf") # pylint: disable=no-member
|
||||
story += self.bul_part_below(format="pdf") # pylint: disable=no-member
|
||||
# signatures
|
||||
objects += self.bul_signatures_pdf() # pylint: disable=no-member
|
||||
story += self.bul_signatures_pdf() # pylint: disable=no-member
|
||||
if self.scale_table_in_page:
|
||||
# Réduit sur une page
|
||||
objects = [marque_debut_bulletin, KeepInFrame(0, 0, objects, mode="shrink")]
|
||||
story = [marque_debut_bulletin, KeepInFrame(0, 0, story, mode="shrink")]
|
||||
else:
|
||||
# Insere notre marqueur qui permet de générer les bookmarks et filigrannes:
|
||||
objects.insert(index_obj_debut, marque_debut_bulletin)
|
||||
story.insert(index_obj_debut, marque_debut_bulletin)
|
||||
#
|
||||
# objects.append(sco_pdf.FinBulletin())
|
||||
if not stand_alone:
|
||||
objects.append(PageBreak()) # insert page break at end
|
||||
return objects
|
||||
if self.multi_pages:
|
||||
# Bulletins sur plusieurs page, force début suivant sur page impaire
|
||||
story.append(
|
||||
DocIf("doc.page%2 == 1", [PageBreak(), PageBreak()], [PageBreak()])
|
||||
)
|
||||
else:
|
||||
story.append(PageBreak()) # insert page break at end
|
||||
|
||||
return story
|
||||
else:
|
||||
# Generation du document PDF
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
@ -198,7 +213,7 @@ class BulletinGenerator:
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
document.build(story)
|
||||
data = report.getvalue()
|
||||
return data
|
||||
|
||||
|
@ -359,7 +359,6 @@ class BulletinDocTemplate(BaseDocTemplate):
|
||||
)
|
||||
if flowable.filigranne:
|
||||
self.filigranne = flowable.filigranne
|
||||
# log(f"afterFlowable addOutlineEntry {flowable.bookmark} page {self.page}")
|
||||
|
||||
|
||||
def _makeTimeDict():
|
||||
|
Loading…
Reference in New Issue
Block a user