forked from ScoDoc/ScoDoc
adaptation de code de traitement des templates pdf
This commit is contained in:
parent
ecd637fb39
commit
f219b8d003
@ -60,11 +60,8 @@ from reportlab.lib.pagesizes import letter, A4, landscape
|
|||||||
from flask import g
|
from flask import g
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.sco_utils import (
|
from app.scodoc.sco_logos import find_logo
|
||||||
CONFIG,
|
from app.scodoc.sco_utils import CONFIG
|
||||||
SCODOC_LOGOS_DIR,
|
|
||||||
LOGOS_IMAGES_ALLOWED_TYPES,
|
|
||||||
)
|
|
||||||
from app import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoGenError, ScoValueError
|
from app.scodoc.sco_exceptions import ScoGenError, ScoValueError
|
||||||
import sco_version
|
import sco_version
|
||||||
@ -219,20 +216,16 @@ class ScolarsPageTemplate(PageTemplate):
|
|||||||
)
|
)
|
||||||
PageTemplate.__init__(self, "ScolarsPageTemplate", [content])
|
PageTemplate.__init__(self, "ScolarsPageTemplate", [content])
|
||||||
self.logo = None
|
self.logo = None
|
||||||
# XXX COPIED from sco_pvpdf, to be refactored (no time now)
|
logo = find_logo(
|
||||||
# Search background in dept specific dir, then in global config dir
|
logoname="bul_pdf_background", dept_id=g.scodoc_dept_id, prefix=None
|
||||||
for image_dir in (
|
)
|
||||||
SCODOC_LOGOS_DIR + "/logos_" + g.scodoc_dept + "/",
|
if logo is None:
|
||||||
SCODOC_LOGOS_DIR + "/", # global logos
|
# Also try to use PV background
|
||||||
):
|
logo = find_logo(
|
||||||
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
logoname="letter_background", dept_id=g.scodoc_dept_id, prefix=None
|
||||||
fn = image_dir + "/bul_pdf_background" + "." + suffix
|
)
|
||||||
if not self.background_image_filename and os.path.exists(fn):
|
if logo is not None:
|
||||||
self.background_image_filename = fn
|
self.background_image_filename = logo.filepath
|
||||||
# Also try to use PV background
|
|
||||||
fn = image_dir + "/letter_background" + "." + suffix
|
|
||||||
if not self.background_image_filename and os.path.exists(fn):
|
|
||||||
self.background_image_filename = fn
|
|
||||||
|
|
||||||
def beforeDrawPage(self, canvas, doc):
|
def beforeDrawPage(self, canvas, doc):
|
||||||
"""Draws (optional) background, logo and contribution message on each page.
|
"""Draws (optional) background, logo and contribution message on each page.
|
||||||
|
Loading…
Reference in New Issue
Block a user