Skip to content

Commit

Permalink
fix widths in rundowns technical export (#2568)
Browse files Browse the repository at this point in the history
SDESK-7217
  • Loading branch information
petrjasek committed May 10, 2024
1 parent c70ae81 commit 0728e21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions apps/rundowns/formatters/pdf.py
@@ -1,11 +1,12 @@
import io
import reportlab.lib.colors as colors

from typing import List
from typing import List, Sequence, Union

from reportlab.platypus import SimpleDocTemplate, Paragraph, Flowable, Table
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import landscape, A4
from reportlab.lib.units import cm, inch
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

Expand Down Expand Up @@ -110,12 +111,18 @@ def get_contents(self, show, rundown, items) -> List[Flowable]:
columns = utils.table_columns(subitems)
data = [columns]
for i, item in enumerate(items, start=1):
data.append(utils.item_table_data(show, rundown, item, i, subitems))
item_cols = utils.item_table_data(show, rundown, item, i, subitems)
for i in range(1, len(item_cols) - 1):
# use paragraph for all columns but first and last, it allows for line breaks
item_cols[i] = Paragraph(item_cols[i])
data.append(item_cols)
t = Table(
data,
colWidths=[inch, 1.5 * inch, 2.5 * inch, 2.5 * inch, 2.5 * inch, inch],
style=[
("GRID", (0, 0), (-1, -1), 0.25, colors.black),
("FONTNAME", (0, 0), (-1, -1), MONO_FONT_NAME),
("VALIGN", (0, 0), (-1, -1), "TOP"),
],
)
t.hAlign = "LEFT"
Expand Down
2 changes: 1 addition & 1 deletion features/rundowns.feature
Expand Up @@ -798,7 +798,7 @@ Feature: Rundowns
"subitems": [
{
"qcode": "WALL",
"technical_info": "wall info",
"technical_info": "wall info something much longer so we will see what this does to the pdf",
"content": "some content"
},
{
Expand Down

0 comments on commit 0728e21

Please sign in to comment.