|
@@ -34,7 +34,6 @@ def JM2L_large_Logo(canvas, Offset=(0,0)): |
|
|
yearobject.setWordSpace(1) |
|
|
yearobject.setWordSpace(1) |
|
|
canvas.drawText(yearobject) |
|
|
canvas.drawText(yearobject) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def one_time_step(canvas, str, hour, max_size, offset): |
|
|
def one_time_step(canvas, str, hour, max_size, offset): |
|
|
max_x, max_y = max_size |
|
|
max_x, max_y = max_size |
|
|
off_x, off_y = offset |
|
|
off_x, off_y = offset |
|
@@ -46,6 +45,54 @@ def one_time_step(canvas, str, hour, max_size, offset): |
|
|
if hour<9: |
|
|
if hour<9: |
|
|
canvas.line(off_x-2, hour_place+half_step, off_x, hour_place+half_step) |
|
|
canvas.line(off_x-2, hour_place+half_step, off_x, hour_place+half_step) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name='stand_print', http_cache = (EXPIRATION_TIME, {'public':True})) |
|
|
|
|
|
def stand_print(request): |
|
|
|
|
|
# Ok let's generate a print for place schedule |
|
|
|
|
|
|
|
|
|
|
|
# Register LiberationMono font |
|
|
|
|
|
ttfFile = "jm2l/static/fonts/LiberationMono-Regular.ttf" |
|
|
|
|
|
pdfmetrics.registerFont(TTFont("Liberation", ttfFile)) |
|
|
|
|
|
# Import font |
|
|
|
|
|
ttfFile_Logo = "jm2l/static/fonts/PWTinselLetters.ttf" |
|
|
|
|
|
pdfmetrics.registerFont(TTFont("Logo", ttfFile_Logo)) |
|
|
|
|
|
|
|
|
|
|
|
pdf = StringIO.StringIO() |
|
|
|
|
|
|
|
|
|
|
|
c = canvas.Canvas( pdf, pagesize=(HEIGHT, WIDTH) ) |
|
|
|
|
|
c.translate(mm, mm) |
|
|
|
|
|
|
|
|
|
|
|
# Feed some metadata |
|
|
|
|
|
c.setCreator("linux-azur.org") |
|
|
|
|
|
c.setTitle("Affiches stand") |
|
|
|
|
|
|
|
|
|
|
|
c.saveState() |
|
|
|
|
|
|
|
|
|
|
|
year = int(request.matchdict.get('year', CurrentYear)) |
|
|
|
|
|
|
|
|
|
|
|
Events = DBSession.query(Event)\ |
|
|
|
|
|
.filter(Event.for_year == year)\ |
|
|
|
|
|
.filter(Event.event_type == "Stand") |
|
|
|
|
|
|
|
|
|
|
|
for ev in Events: |
|
|
|
|
|
c.setFont('Logo', 50) |
|
|
|
|
|
c.setFillColorRGB(.5,.5,.5) |
|
|
|
|
|
c.drawString(HEIGHT-150, 30, "JM2L") |
|
|
|
|
|
c.setFont('Logo', 100) |
|
|
|
|
|
c.setFillColorRGB(0.5,0.5,0.5) |
|
|
|
|
|
c.drawCentredString(HEIGHT/2, WIDTH-90, "STAND", 0) |
|
|
|
|
|
c.setFillColorRGB(0,0,0) |
|
|
|
|
|
c.setFont('Helvetica', 42) |
|
|
|
|
|
c.drawCentredString(HEIGHT/2, WIDTH/2, ev.name, 0) |
|
|
|
|
|
c.showPage() |
|
|
|
|
|
|
|
|
|
|
|
c.save() |
|
|
|
|
|
pdf.seek(0) |
|
|
|
|
|
|
|
|
|
|
|
return Response(app_iter=pdf, content_type = 'application/pdf' ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name='place_print', http_cache = (EXPIRATION_TIME, {'public':True})) |
|
|
@view_config(route_name='place_print', http_cache = (EXPIRATION_TIME, {'public':True})) |
|
|
def place_print(request): |
|
|
def place_print(request): |
|
|
# Ok let's generate a print for place schedule |
|
|
# Ok let's generate a print for place schedule |
|
@@ -103,7 +150,7 @@ def place_print(request): |
|
|
for i in range(0,10): |
|
|
for i in range(0,10): |
|
|
one_time_step(c, "%.2dh00" % (i+10), i, max_size, offset) |
|
|
one_time_step(c, "%.2dh00" % (i+10), i, max_size, offset) |
|
|
|
|
|
|
|
|
c.setFont('Helvetica', 12) |
|
|
|
|
|
|
|
|
#c.setFont('Helvetica', 12) |
|
|
Events = DBSession.query(Event)\ |
|
|
Events = DBSession.query(Event)\ |
|
|
.filter(Event.for_year == year)\ |
|
|
.filter(Event.for_year == year)\ |
|
|
.filter(Event.salle_uid == place_uid)\ |
|
|
.filter(Event.salle_uid == place_uid)\ |
|
@@ -125,11 +172,13 @@ def place_time(c, ev, max_size, offset): |
|
|
start_pos_y = ((int( ev.start_time.strftime('%H') )-10)*60 + int( ev.start_time.strftime('%M') )) * minute |
|
|
start_pos_y = ((int( ev.start_time.strftime('%H') )-10)*60 + int( ev.start_time.strftime('%M') )) * minute |
|
|
stop_pos_y = ((int( ev.end_time.strftime('%H') )-10)*60 + int( ev.end_time.strftime('%M') )) * minute |
|
|
stop_pos_y = ((int( ev.end_time.strftime('%H') )-10)*60 + int( ev.end_time.strftime('%M') )) * minute |
|
|
|
|
|
|
|
|
c.setFillColorRGB(1,1,1) |
|
|
|
|
|
|
|
|
c.setFillColorRGB(0.98,0.98,0.98) |
|
|
c.rect(offset[0], max_y + off_y - start_pos_y, max_size[0], start_pos_y-stop_pos_y, fill=1, stroke=1) |
|
|
c.rect(offset[0], max_y + off_y - start_pos_y, max_size[0], start_pos_y-stop_pos_y, fill=1, stroke=1) |
|
|
c.setFillColorRGB(0,0,0) |
|
|
c.setFillColorRGB(0,0,0) |
|
|
#c.drawString(off_x+5, max_y + off_y - 15 - start_pos_y, ev.start_time.strftime('%H:%M'), 0) |
|
|
#c.drawString(off_x+5, max_y + off_y - 15 - start_pos_y, ev.start_time.strftime('%H:%M'), 0) |
|
|
|
|
|
c.setFont('Helvetica', 12) |
|
|
c.drawCentredString(WIDTH/2, max_y + off_y - 35 - start_pos_y, ev.name, 0) |
|
|
c.drawCentredString(WIDTH/2, max_y + off_y - 35 - start_pos_y, ev.name, 0) |
|
|
intervs = ','.join( [x.slug for x in ev.intervenants] ) |
|
|
|
|
|
c.drawString(WIDTH/2, max_y + off_y - 45 - start_pos_y, intervs, 0) |
|
|
|
|
|
|
|
|
intervs = ', '.join( [x.slug for x in ev.intervenants] ) |
|
|
|
|
|
c.setFont('Helvetica', 10) |
|
|
|
|
|
c.drawCentredString(WIDTH/2, max_y + off_y - 55 - start_pos_y, intervs, 0) |
|
|
|
|
|
|