本文整理汇总了Python中reportlab.platypus.Table._argW[i]方法的典型用法代码示例。如果您正苦于以下问题:Python Table._argW[i]方法的具体用法?Python Table._argW[i]怎么用?Python Table._argW[i]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus.Table
的用法示例。
在下文中一共展示了Table._argW[i]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: workout_log
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[i] [as 别名]
#.........这里部分代码省略.........
rowheights[marker - 1] = 5
# Make the date span 3 cells and align it to the right
table_style.append(('ALIGN', (0, marker + 1), (2, marker + 1), 'RIGHT'))
table_style.append(('SPAN', (0, marker + 1), (2, marker + 1)))
# Combine the cells for exercises on the same set
for marker in group_exercise_marker:
start_marker = group_exercise_marker[marker]['start']
end_marker = group_exercise_marker[marker]['end']
table_style.append(('VALIGN', (0, start_marker), (0, end_marker), 'MIDDLE'))
table_style.append(('SPAN', (0, start_marker), (0, end_marker)))
# Set an alternating background colour for rows
for i in exercise_markers:
counter = 1
for j in exercise_markers[i]:
if not j % 2:
table_style.append(('BACKGROUND', (1, j - 1), (-1, j - 1), colors.lavender))
counter += 1
# Make the 'impression' span 3 cells and align it to the right
for marker in group_day_marker:
start_marker = group_day_marker[marker]['start']
end_marker = group_day_marker[marker]['end']
#table_style.append(('ALIGN', (0, end_marker - 2), (2, end_marker - 2), 'RIGHT'))
# There is an empty cell between the day blocks, set a border around them
table_style.append(('INNERGRID',
(0, start_marker),
(- 1, end_marker - 2),
0.25,
colors.black))
table_style.append(('BOX',
(0, start_marker),
(-1, end_marker - 2),
1.25,
colors.black))
# Set the table data
if data:
t = Table(data, colwidths, rowheights, style=table_style)
# Manually set the width of the columns
for i in range(first_weight_column, nr_of_weeks + first_weight_column):
t._argW[i] = 1.8 * cm # Columns for entering the log
t._argW[0] = 0.6 * cm # Exercise numbering
t._argW[1] = 3.5 * cm # Name of exercise
t._argW[2] = 1.9 * cm # Repetitions
# There is nothing to output
else:
t = Paragraph(_('<i>This is an empty workout, what did you expect on the PDF?</i>'),
styleSheet["Normal"])
#
# Add all elements to the document
#
# Set the title (if available)
if workout.comment:
P = Paragraph('<para align="center"><strong>%(description)s</strong></para>' %
{'description': workout.comment},
styleSheet["Bold"])
elements.append(P)
# Filler
P = Paragraph('<para> </para>', styleSheet["Normal"])
elements.append(P)
# Append the table
elements.append(t)
# Footer, add filler paragraph
P = Paragraph('<para> </para>', styleSheet["Normal"])
elements.append(P)
# Print date and info
created = datetime.date.today().strftime("%d.%m.%Y")
url = reverse('wger.manager.views.workout.view', kwargs={'id': workout.id})
P = Paragraph('''<para align="left">
%(date)s -
<a href="%(url)s">%(url)s</a> -
%(created)s
%(version)s
</para>''' %
{'date': _("Created on the <b>%s</b>") % created,
'created': "wger Workout Manager",
'version': get_version(),
'url': request.build_absolute_uri(url), },
styleSheet["Normal"])
elements.append(P)
# write the document and send the response to the browser
doc.build(elements)
return response