forked from ScoDoc/ScoDoc
Numéros pages sur bulletins BUT. Closes #652
This commit is contained in:
parent
50f2cd7a0f
commit
9897ccc659
@ -226,6 +226,7 @@ class BulletinGenerator:
|
|||||||
server_name=self.server_name,
|
server_name=self.server_name,
|
||||||
filigranne=self.filigranne,
|
filigranne=self.filigranne,
|
||||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||||
|
with_page_numbers=self.multi_pages,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
@ -106,6 +106,7 @@ def assemble_bulletins_pdf(
|
|||||||
pagesbookmarks=pagesbookmarks,
|
pagesbookmarks=pagesbookmarks,
|
||||||
filigranne=filigranne,
|
filigranne=filigranne,
|
||||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||||
|
with_page_numbers=False, # on ne veut pas de no de pages sur les bulletins imprimés en masse
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
document.multiBuild(story)
|
document.multiBuild(story)
|
||||||
|
@ -247,6 +247,7 @@ class ScoDocPageTemplate(PageTemplate):
|
|||||||
footer_template=DEFAULT_PDF_FOOTER_TEMPLATE,
|
footer_template=DEFAULT_PDF_FOOTER_TEMPLATE,
|
||||||
filigranne=None,
|
filigranne=None,
|
||||||
preferences=None, # dictionnary with preferences, required
|
preferences=None, # dictionnary with preferences, required
|
||||||
|
with_page_numbers=False,
|
||||||
):
|
):
|
||||||
"""Initialise our page template."""
|
"""Initialise our page template."""
|
||||||
# defered import (solve circular dependency ->sco_logo ->scodoc, ->sco_pdf
|
# defered import (solve circular dependency ->sco_logo ->scodoc, ->sco_pdf
|
||||||
@ -259,8 +260,9 @@ class ScoDocPageTemplate(PageTemplate):
|
|||||||
self.pdfmeta_subject = subject
|
self.pdfmeta_subject = subject
|
||||||
self.server_name = server_name
|
self.server_name = server_name
|
||||||
self.filigranne = filigranne
|
self.filigranne = filigranne
|
||||||
self.page_number = 1
|
|
||||||
self.footer_template = footer_template
|
self.footer_template = footer_template
|
||||||
|
self.with_page_numbers = with_page_numbers
|
||||||
|
self.page_number = 1
|
||||||
if self.preferences:
|
if self.preferences:
|
||||||
self.with_page_background = self.preferences["bul_pdf_with_background"]
|
self.with_page_background = self.preferences["bul_pdf_with_background"]
|
||||||
else:
|
else:
|
||||||
@ -337,6 +339,7 @@ class ScoDocPageTemplate(PageTemplate):
|
|||||||
|
|
||||||
def draw_footer(self, canv, content):
|
def draw_footer(self, canv, content):
|
||||||
"""Print the footer"""
|
"""Print the footer"""
|
||||||
|
# called 1/page
|
||||||
try:
|
try:
|
||||||
canv.setFont(
|
canv.setFont(
|
||||||
self.preferences["SCOLAR_FONT"],
|
self.preferences["SCOLAR_FONT"],
|
||||||
@ -353,6 +356,9 @@ class ScoDocPageTemplate(PageTemplate):
|
|||||||
self.preferences["pdf_footer_y"] * mm,
|
self.preferences["pdf_footer_y"] * mm,
|
||||||
content + " " + (self.preferences["pdf_footer_extra"] or ""),
|
content + " " + (self.preferences["pdf_footer_extra"] or ""),
|
||||||
)
|
)
|
||||||
|
if self.with_page_numbers:
|
||||||
|
canv.drawString(190.0 * mm, 6 * mm, f"Page {self.page_number}")
|
||||||
|
|
||||||
canv.restoreState()
|
canv.restoreState()
|
||||||
|
|
||||||
def footer_string(self) -> str:
|
def footer_string(self) -> str:
|
||||||
@ -389,11 +395,7 @@ class ScoDocPageTemplate(PageTemplate):
|
|||||||
canv.drawCentredString(0, 0, SU(filigranne))
|
canv.drawCentredString(0, 0, SU(filigranne))
|
||||||
canv.restoreState()
|
canv.restoreState()
|
||||||
doc.filigranne = None
|
doc.filigranne = None
|
||||||
|
# Increment page number
|
||||||
def afterPage(self):
|
|
||||||
"""Called after all flowables have been drawn on a page.
|
|
||||||
Increment pageNum since the page has been completed.
|
|
||||||
"""
|
|
||||||
self.page_number += 1
|
self.page_number += 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.6.968"
|
SCOVERSION = "9.6.969"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user