adaptation du code d'édition des pv

This commit is contained in:
Jean-Marie Place 2021-11-07 09:05:53 +01:00
parent d7e34b8ce2
commit ecd637fb39

View File

@ -52,6 +52,7 @@ from app.scodoc import sco_pdf
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc import sco_etud from app.scodoc import sco_etud
import sco_version import sco_version
from app.scodoc.sco_logos import find_logo
from app.scodoc.sco_pdf import PDFLOCK from app.scodoc.sco_pdf import PDFLOCK
from app.scodoc.sco_pdf import SU from app.scodoc.sco_pdf import SU
@ -201,30 +202,33 @@ class CourrierIndividuelTemplate(PageTemplate):
self.logo_footer = None self.logo_footer = None
self.logo_header = None self.logo_header = None
# Search logos in dept specific dir, then in global scu.CONFIG dir # Search logos in dept specific dir, then in global scu.CONFIG dir
for image_dir in (
scu.SCODOC_LOGOS_DIR + "/logos_" + g.scodoc_dept,
scu.SCODOC_LOGOS_DIR, # global logos
):
for suffix in scu.LOGOS_IMAGES_ALLOWED_TYPES:
if template_name == "PVJuryTemplate": if template_name == "PVJuryTemplate":
fn = image_dir + "/pvjury_background" + "." + suffix background = find_logo(
logoname="pvjury_background",
dept_id=g.scodoc_dept_id,
prefix="",
)
else: else:
fn = image_dir + "/letter_background" + "." + suffix background = find_logo(
if not self.background_image_filename and os.path.exists(fn): logoname="letter_background",
self.background_image_filename = fn dept_id=g.scodoc_dept_id,
prefix="",
)
if not self.background_image_filename and background is not None:
self.background_image_filename = background.filepath
fn = image_dir + "/logo_footer" + "." + suffix footer = find_logo(logoname="footer", dept_id=g.scodoc_dept_id)
if not self.logo_footer and os.path.exists(fn): if footer is not None:
self.logo_footer = Image( self.logo_footer = Image(
fn, footer.filepath,
height=LOGO_FOOTER_HEIGHT, height=LOGO_FOOTER_HEIGHT,
width=LOGO_FOOTER_WIDTH, width=LOGO_FOOTER_WIDTH,
) )
fn = image_dir + "/logo_header" + "." + suffix header = find_logo(logoname="header", dept_id=g.scodoc_dept_id)
if not self.logo_header and os.path.exists(fn): if header is not None:
self.logo_header = Image( self.logo_header = Image(
fn, header.filepath,
height=LOGO_HEADER_HEIGHT, height=LOGO_HEADER_HEIGHT,
width=LOGO_HEADER_WIDTH, width=LOGO_HEADER_WIDTH,
) )