PDF: Restructured ballot stylesheets.

This commit is contained in:
Emanuel Schuetze 2011-09-02 17:39:32 +02:00
parent 590d56a80e
commit 1811f0108c

View File

@ -102,57 +102,57 @@ stylesheet.add(ParagraphStyle(name = 'Tablecell',
parent = stylesheet['Normal'], parent = stylesheet['Normal'],
fontSize = 9) fontSize = 9)
) )
# Ballot stylesheets
stylesheet.add(ParagraphStyle(name = 'Ballot_title',
h3_poll = PS(name = 'h3_poll', parent = stylesheet['Bold'],
fontName = 'Ubuntu-Bold',
fontSize = 12, fontSize = 12,
leading = 14, leading = 14,
leftIndent = 30, leftIndent = 30),
spaceAfter = 0) )
i_poll = PS(name = 'i_poll', stylesheet.add(ParagraphStyle(name = 'Ballot_subtitle',
fontName = 'Ubuntu', parent = stylesheet['Normal'],
fontSize = 10, fontSize = 10,
leading = 20,
leftIndent = 30, leftIndent = 30,
rightIndent = 20, rightIndent = 20),
spaceAfter = 0) )
small_poll = PS(name = 'small', stylesheet.add(ParagraphStyle(name = 'Ballot_description',
fontName = 'Ubuntu', parent = stylesheet['Normal'],
fontSize = 7, fontSize = 7,
leading = 14, leading = 14,
leftIndent = 30, leftIndent = 30),
spaceAfter = 0) )
polloption = PS(name = 'polloption', stylesheet.add(ParagraphStyle(name = 'Ballot_option',
fontName = 'Ubuntu', parent = stylesheet['Normal'],
fontSize = 12, fontSize = 12,
leading = 24, leading = 24,
leftIndent = 30, leftIndent = 30),
spaceAfter = 0) )
polloptionname = PS(name = 'polloption', stylesheet.add(ParagraphStyle(name = 'Ballot_option_name',
fontName = 'Ubuntu', parent = stylesheet['Normal'],
fontSize = 12, fontSize = 12,
leading = 15, leading = 15,
leftIndent = 30, leftIndent = 30),
spaceAfter = 0) )
polloptionnameRight = PS(name = 'polloption', stylesheet.add(ParagraphStyle(name = 'Ballot_option_group',
fontName = 'Ubuntu', parent = stylesheet['Normal'],
fontSize = 8,
leading = 15,
leftIndent = 30),
)
stylesheet.add(ParagraphStyle(name = 'Ballot_option_YNA',
parent = stylesheet['Normal'],
fontSize = 12, fontSize = 12,
leading = 15, leading = 15,
leftIndent = 49, leftIndent = 49,
spaceAfter = 18) spaceAfter = 18),
polloptiongroup = PS(name = 'polloptiongroup', )
fontName = 'Ubuntu', stylesheet.add(ParagraphStyle(name = 'Ballot_option_group_right',
parent = stylesheet['Normal'],
fontSize = 8, fontSize = 8,
leading = 16, leading = 16,
leftIndent = 49, leftIndent = 49),
spaceAfter = 0) )
polloptiongroupLeft = PS(name = 'polloptiongroupleft',
fontName = 'Ubuntu',
fontSize = 8,
leading = 15,
leftIndent = 30,
spaceAfter = 0)
# set event information # set event information
event_name = config_get("event_name") event_name = config_get("event_name")
@ -336,14 +336,14 @@ def print_application_poll(request, poll_id=None):
circle = "<img src='openslides/static/images/circle.png' width='15' height='15'/>&nbsp;&nbsp;" circle = "<img src='openslides/static/images/circle.png' width='15' height='15'/>&nbsp;&nbsp;"
cell = [] cell = []
cell.append(Spacer(0,0.8*cm)) cell.append(Spacer(0,0.8*cm))
cell.append(Paragraph(poll.title, h3_poll)) cell.append(Paragraph(poll.title, stylesheet['Ballot_title']))
cell.append(Paragraph(_("Title")+": "+poll.application.title, i_poll)) cell.append(Paragraph(_("Title")+": "+poll.application.title, stylesheet['Ballot_subtitle']))
if poll.description: if poll.description:
cell.append(Paragraph(poll.description, small_poll)) cell.append(Paragraph(poll.description, stylesheet['Ballot_description']))
cell.append(Spacer(0,0.5*cm)) cell.append(Spacer(0,0.5*cm))
cell.append(Paragraph(circle+_("Yes"), polloption)) cell.append(Paragraph(circle+_("Yes"), stylesheet['Ballot_option']))
cell.append(Paragraph(circle+_("No"), polloption)) cell.append(Paragraph(circle+_("No"), stylesheet['Ballot_option']))
cell.append(Paragraph(circle+_("Abstention"), polloption)) cell.append(Paragraph(circle+_("Abstention"), stylesheet['Ballot_option']))
data= [] data= []
for user in xrange(User.objects.count()/2): for user in xrange(User.objects.count()/2):
@ -367,10 +367,10 @@ def print_assignment_poll(request, poll_id=None, ballotnumber=1, posts=None):
circle = "<img src='openslides/static/images/circle.png' width='15' height='15'/>&nbsp;" circle = "<img src='openslides/static/images/circle.png' width='15' height='15'/>&nbsp;"
cell = [] cell = []
cell.append(Spacer(0,0.8*cm)) cell.append(Spacer(0,0.8*cm))
cell.append(Paragraph(poll.title, h3_poll)) cell.append(Paragraph(poll.title, stylesheet['Ballot_title']))
cell.append(Paragraph(poll.description, i_poll)) cell.append(Paragraph(poll.description, stylesheet['Ballot_subtitle']))
options = poll.get_options().order_by('user__user__first_name') options = poll.get_options().order_by('user__user__first_name')
cell.append(Paragraph(ballotnumber+". "+_("ballot")+", "+str(len(options))+" "+ ungettext("candidate", "candidates", len(options))+", "+posts+" "+_("available posts"), small_poll)) cell.append(Paragraph(ballotnumber+". "+_("ballot")+", "+str(len(options))+" "+ ungettext("candidate", "candidates", len(options))+", "+posts+" "+_("available posts"), stylesheet['Ballot_description']))
cell.append(Spacer(0,0.4*cm)) cell.append(Spacer(0,0.4*cm))
if len(options) <= int(posts): if len(options) <= int(posts):
@ -381,12 +381,12 @@ def print_assignment_poll(request, poll_id=None, ballotnumber=1, posts=None):
if optiondecision: if optiondecision:
for option in options: for option in options:
o = str(option).rsplit("(",1) o = str(option).rsplit("(",1)
cell.append(Paragraph(o[0], polloptionname)) cell.append(Paragraph(o[0], stylesheet['Ballot_option_name']))
if len(o) > 1: if len(o) > 1:
cell.append(Paragraph("("+o[1], polloptiongroupLeft)) cell.append(Paragraph("("+o[1], stylesheet['Ballot_option_group']))
else: else:
cell.append(Paragraph("&nbsp;", polloptiongroupLeft)) cell.append(Paragraph("&nbsp;", stylesheet['Ballot_option_group']))
cell.append(Paragraph(circle+_("Yes")+"&nbsp; &nbsp; &nbsp; "+circle+_("No")+"&nbsp; &nbsp; &nbsp; "+circle+_("Abstention"), polloptionnameRight)) cell.append(Paragraph(circle+_("Yes")+"&nbsp; &nbsp; &nbsp; "+circle+_("No")+"&nbsp; &nbsp; &nbsp; "+circle+_("Abstention"), stylesheet['Ballot_option_YNA']))
data= [] data= []
for user in xrange(User.objects.count()/2): for user in xrange(User.objects.count()/2):
data.append([cell,cell]) data.append([cell,cell])
@ -399,11 +399,11 @@ def print_assignment_poll(request, poll_id=None, ballotnumber=1, posts=None):
else: else:
for option in options: for option in options:
o = str(option).rsplit("(",1) o = str(option).rsplit("(",1)
cell.append(Paragraph(circle+o[0], polloptionname)) cell.append(Paragraph(circle+o[0], stylesheet['Ballot_option_name']))
if len(o) > 1: if len(o) > 1:
cell.append(Paragraph("("+o[1], polloptiongroup)) cell.append(Paragraph("("+o[1], stylesheet['Ballot_option_group_right']))
else: else:
cell.append(Paragraph("&nbsp;", polloptiongroup)) cell.append(Paragraph("&nbsp;", stylesheet['Ballot_option_group_right']))
data= [] data= []
for user in xrange(User.objects.count()/2): for user in xrange(User.objects.count()/2):
data.append([cell,cell]) data.append([cell,cell])