mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-10-31 23:45:49 +00:00
pdf export: add all answered questions to page
This commit is contained in:
parent
d03fef4e34
commit
5930907aa1
1 changed files with 27 additions and 0 deletions
|
@ -48,6 +48,21 @@ class PDFInfoPage(Flowable):
|
||||||
item.drawOn(self.canv, PAGE_PADDING + 1.3 * height, -self.y_position)
|
item.drawOn(self.canv, PAGE_PADDING + 1.3 * height, -self.y_position)
|
||||||
self.canv.rect(PAGE_PADDING, -self.y_position, height * 0.8, height * 0.8)
|
self.canv.rect(PAGE_PADDING, -self.y_position, height * 0.8, height * 0.8)
|
||||||
|
|
||||||
|
def _question_text(self, question, answer, **kwargs):
|
||||||
|
item = Paragraph(question, **kwargs)
|
||||||
|
_, height = item.wrapOn(
|
||||||
|
self.canv, A4_WIDTH - 2 * PAGE_PADDING, A4_HEIGHT - 2 * PAGE_PADDING
|
||||||
|
)
|
||||||
|
self.y_position += height + 2 * mm
|
||||||
|
item.drawOn(self.canv, PAGE_PADDING, -self.y_position)
|
||||||
|
|
||||||
|
item = Paragraph(answer, **kwargs)
|
||||||
|
_, height = item.wrapOn(
|
||||||
|
self.canv, A4_WIDTH - 3 * PAGE_PADDING, A4_HEIGHT - 2 * PAGE_PADDING
|
||||||
|
)
|
||||||
|
self.y_position += height + 2 * mm
|
||||||
|
item.drawOn(self.canv, 2*PAGE_PADDING, -self.y_position)
|
||||||
|
|
||||||
def _space(self):
|
def _space(self):
|
||||||
self._add(Spacer(1, PAGE_PADDING / 2))
|
self._add(Spacer(1, PAGE_PADDING / 2))
|
||||||
|
|
||||||
|
@ -142,6 +157,15 @@ class PDFInfoPage(Flowable):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.talk.submission.answers:
|
||||||
|
self._space()
|
||||||
|
for answer in sorted(self.talk.submission.answers.all()):
|
||||||
|
self._question_text(
|
||||||
|
str(answer.question.question),
|
||||||
|
answer.answer,
|
||||||
|
style=self.style["Question"],
|
||||||
|
)
|
||||||
|
|
||||||
if self.talk.submission.notes:
|
if self.talk.submission.notes:
|
||||||
self._space()
|
self._space()
|
||||||
for line in self.talk.submission.notes.splitlines():
|
for line in self.talk.submission.notes.splitlines():
|
||||||
|
@ -221,6 +245,9 @@ class PDFExporter(ScheduleData):
|
||||||
stylesheet.add(
|
stylesheet.add(
|
||||||
ParagraphStyle(name="Meta", fontName="Helvetica", fontSize=14, leading=16)
|
ParagraphStyle(name="Meta", fontName="Helvetica", fontSize=14, leading=16)
|
||||||
)
|
)
|
||||||
|
stylesheet.add(
|
||||||
|
ParagraphStyle(name="Question", fontName="Helvetica", fontSize=12, leading=14)
|
||||||
|
)
|
||||||
stylesheet.add(
|
stylesheet.add(
|
||||||
ParagraphStyle(
|
ParagraphStyle(
|
||||||
name="Abstract", fontName="Helvetica-Oblique", fontSize=10, leading=12
|
name="Abstract", fontName="Helvetica-Oblique", fontSize=10, leading=12
|
||||||
|
|
Loading…
Reference in a new issue