diff options
author | Martin Vilcans <martin@librador.com> | 2014-10-09 09:53:45 +0200 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2014-10-09 09:53:45 +0200 |
commit | 3656b855dadbdbd1a5b30f41b39646bdb07659e9 (patch) | |
tree | 28929f91c27f585d33e75c57225fd8034b121158 | |
parent | 42122263807657061682e82c6699e089042f6a96 (diff) | |
download | screenplain-3656b855dadbdbd1a5b30f41b39646bdb07659e9.tar.gz |
Support centered action paragraphs in pdf
-rw-r--r-- | screenplain/export/pdf.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/screenplain/export/pdf.py b/screenplain/export/pdf.py index dcad855..957dd82 100644 --- a/screenplain/export/pdf.py +++ b/screenplain/export/pdf.py @@ -12,6 +12,7 @@ from reportlab.platypus import ( from reportlab import platypus from reportlab.lib.units import inch from reportlab.lib.styles import ParagraphStyle +from reportlab.lib.enums import TA_CENTER from screenplain.types import ( Action, Dialog, DualDialog, Transition, Slug @@ -60,6 +61,10 @@ action_style = ParagraphStyle( 'action', default_style, spaceBefore=12, ) +centered_action_style = ParagraphStyle( + 'centered-action', action_style, + alignment=TA_CENTER, +) slug_style = ParagraphStyle( 'slug', default_style, spaceBefore=12, @@ -132,8 +137,10 @@ def to_pdf(screenplay, output_filename, template_constructor=DocTemplate): elif isinstance(para, DualDialog): add_dual_dialog(story, para) elif isinstance(para, Action): - # TODO: heed para.centered - add_paragraph(story, para, action_style) + add_paragraph( + story, para, + centered_action_style if para.centered else action_style + ) elif isinstance(para, Slug): add_paragraph(story, para, slug_style) elif isinstance(para, Transition): |