Changeset 9555 for main/waeup.kofa/trunk/src
- Timestamp:
- 6 Nov 2012, 10:54:46 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/interfaces.py
r9546 r9555 180 180 """ 181 181 def create_pdf(data, headerline=None, title=None, author=None, 182 footer='', note=None, sig _in_footer=False):182 footer='', note=None, sigs_in_footer=[]): 183 183 """Create a PDF. 184 184 … … 196 196 page numbers. 197 197 198 `sig _in_footer`, if set to ``True`` renders signature boxes199 above the footer oneach page.198 `sigs_in_footer` is a set of translateable strings that will be 199 rendered into signature boxes at bottom of each page. 200 200 201 201 If no `headerline` is given, a default will be rendered (name -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r9547 r9555 208 208 canvas.saveState() 209 209 canvas.setFont("Helvetica", 10) 210 canvas.drawString(211 2.2*cm + 0.2*cm, 1.35 * inch,212 translate(_('Date, Student Signature')))213 canvas.drawString(214 width/2.0 + 0.15*cm + 0.4*cm, 1.35 * inch,215 translate(_('Date, Clearance Officer Signature')))216 canvas.rect(2.2*cm, 0.75*inch, width/2.0-2.1*cm, 0.75*inch)217 canvas.rect(width/2.0+0.3*cm, 0.75*inch, width/2.0-2.5*cm, 0.75*inch)210 mystring = "%r" % ([translate(sig) for sig in signatures]) 211 for num, sig in enumerate(signatures): 212 box_width = (width - 4.2*cm) / len(signatures) 213 x_box = 2.1*cm + (box_width) * num 214 y_box = 0.75*inch 215 canvas.rect(x_box+0.1*cm, y_box, box_width-0.2*cm, 0.75*inch) 216 canvas.drawString( 217 x_box+0.2*cm, 1.35*inch, translate(sig)) 218 218 canvas.restoreState() 219 219 return canvas … … 361 361 # Footer 362 362 canvas.saveState() 363 if getattr(doc, 'sig_in_footer', False): 364 self._drawSignatureBoxes(canvas, width, height) 363 if getattr(doc, 'sigs_in_footer', False): 364 self._drawSignatureBoxes( 365 canvas, width, height, doc.sigs_in_footer) 365 366 canvas.line(2.2*cm, 0.62*inch, width-2.2*cm, 0.62*inch) 366 367 canvas.setFont("Helvetica", 9) … … 384 385 385 386 def create_pdf(self, data, headerline=None, title=None, author=None, 386 footer='', note=None, sig _in_footer=False):387 footer='', note=None, sigs_in_footer=[]): 387 388 """Returns a binary data stream which is a PDF document. 388 389 """ 389 390 pdf_stream = StringIO() 390 bottomMargin = sig_in_footer and 1.4*inch or 0.8*inch391 bottomMargin = len(sigs_in_footer) and 1.9*inch or 1.2*inch 391 392 doc = SimpleDocTemplate( 392 393 pdf_stream, … … 403 404 doc.kofa_author = author 404 405 doc.kofa_footer = footer 405 doc.sig _in_footer = sig_in_footer406 doc.sigs_in_footer = sigs_in_footer 406 407 if note is not None: 407 408 html = format_html(note) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9553 r9555 639 639 return 640 640 641 def _sig InFooter(self):641 def _sigsInFooter(self): 642 642 isStudent = getattr( 643 643 self.request.principal, 'user_type', None) == 'student' 644 644 if not isStudent and self.context.state in (CLEARED, ): 645 return True 645 return (_('Date, Student Signature'), 646 _('Date, Clearance Officer Signature'), 647 ) 646 648 return False 647 649 … … 653 655 self, 'clearance_slip.pdf', 654 656 self.context.student, studentview, signatures=self._signatures(), 655 sig _in_footer=self._sigInFooter())657 sigs_in_footer=self._sigsInFooter()) 656 658 657 659 class StudentClearanceManageFormPage(KofaEditFormPage): -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9550 r9555 506 506 def renderPDF(self, view, filename='slip.pdf', student=None, 507 507 studentview=None, tableheader=None, tabledata=None, 508 note=None, signatures=None, sig _in_footer=False,508 note=None, signatures=None, sigs_in_footer=(), 509 509 show_scans=True): 510 510 """Render pdf slips for various pages. … … 559 559 560 560 # Insert signatures 561 if signatures and not sig _in_footer:561 if signatures and not sigs_in_footer: 562 562 data.append(Spacer(1, 20)) 563 563 signaturetable = get_signature_table(signatures) … … 569 569 pdf_stream = creator.create_pdf( 570 570 data, None, doc_title, author=author, footer=footer_text, 571 note=note, sig _in_footer=sig_in_footer)571 note=note, sigs_in_footer=sigs_in_footer) 572 572 except IOError: 573 573 view.flash('Error in image file.')
Note: See TracChangeset for help on using the changeset viewer.