Changeset 9910 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 24 Jan 2013, 10:34:02 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r9657 r9910 41 41 NORMAL_STYLE = getSampleStyleSheet()['Normal'] 42 42 43 #: A reportlab paragraph style for 'normal' output. 44 HEADING3_STYLE = getSampleStyleSheet()['Heading3'] 45 46 #: A reportlab paragraph style for headings. 47 HEADING_STYLE = ParagraphStyle( 48 name='Heading3', 49 parent=HEADING3_STYLE, 50 fontSize=11, 51 ) 52 43 53 #: A reportlab paragraph style for output of 'code'. 44 54 CODE_STYLE = ParagraphStyle( … … 47 57 fontName='Courier', 48 58 fontSize=10, 59 leading=10, 49 60 ) 50 61 … … 53 64 name='Entry1', 54 65 parent=NORMAL_STYLE, 55 fontSize=12, 66 fontSize=11, 67 leading=10, 56 68 ) 57 69 … … 60 72 name='Small1', 61 73 parent=NORMAL_STYLE, 62 fontSize= 10,74 fontSize=8, 63 75 ) 64 76 … … 68 80 parent=NORMAL_STYLE, 69 81 fontName='Helvetica-Bold', 70 fontSize=1 2,82 fontSize=10, 71 83 ) 72 84 … … 76 88 parent=NORMAL_STYLE, 77 89 fontName='Helvetica', 78 fontSize=1 2,90 fontSize=10, 79 91 ) 80 92 … … 285 297 f_label = translate(widget.label.strip(), domain, 286 298 target_language=lang) 287 f_label = Paragraph( f_label, ENTRY1_STYLE)299 f_label = Paragraph('%s:' % f_label, ENTRY1_STYLE) 288 300 f_text = translate(widget(), domain, target_language=lang) 289 301 f_text = format_html(f_text) … … 304 316 305 317 # Create table 306 table = Table(table_data,style=table_style) 318 table = Table(table_data,style=table_style) #, rowHeights=14) 307 319 table.hAlign = 'LEFT' 308 320 return table -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9907 r9910 33 33 from waeup.kofa.interfaces import MessageFactory as _ 34 34 from waeup.kofa.students.interfaces import IStudentsUtils 35 from waeup.kofa.browser.pdf import ( 36 ENTRY1_STYLE, format_html, NOTE_STYLE, HEADING_STYLE) 37 from waeup.kofa.browser.interfaces import IPDFCreator 35 38 36 39 SLIP_STYLE = [ … … 53 56 54 57 def formatted_label(color=FONT_COLOR, size=FONT_SIZE): 55 tag1 ='<font color=%s size=%d>' % (color, size)58 tag1 ='<font color=%s>' % (color) 56 59 return tag1 + '%s:</font>' 57 60 … … 90 93 text = translate(text, 'zope', target_language=portal_language) 91 94 text = text.replace('</div>', '<br /></div>') 92 tag1 = u'<font color="%s" size="%d">' % (color, size)95 tag1 = u'<font color="%s">' % (color) 93 96 return tag1 + u'%s</font>' % text 94 97 … … 125 128 126 129 f_label = formatted_label(size=12) % _('Name') 127 f_label = Paragraph(f_label, style["Normal"])130 f_label = Paragraph(f_label, ENTRY1_STYLE) 128 131 f_text = formatted_text(studentview.context.display_fullname, size=12) 129 f_text = Paragraph(f_text, style["Normal"])132 f_text = Paragraph(f_text, ENTRY1_STYLE) 130 133 data_right.append([f_label,f_text]) 131 134 … … 136 139 widget.label.strip(), 'waeup.kofa', 137 140 target_language=portal_language) 138 f_label = Paragraph(f_label, style["Normal"])141 f_label = Paragraph(f_label, ENTRY1_STYLE) 139 142 f_text = formatted_text(widget(), size=12) 140 f_text = Paragraph(f_text, style["Normal"])143 f_text = Paragraph(f_text, ENTRY1_STYLE) 141 144 data_right.append([f_label,f_text]) 142 145 143 146 if getattr(studentview.context, 'certcode', None): 144 147 f_label = formatted_label(size=12) % _('Study Course') 145 f_label = Paragraph(f_label, style["Normal"])148 f_label = Paragraph(f_label, ENTRY1_STYLE) 146 149 f_text = formatted_text( 147 150 studentview.context['studycourse'].certificate.longtitle(), size=12) 148 f_text = Paragraph(f_text, style["Normal"])151 f_text = Paragraph(f_text, ENTRY1_STYLE) 149 152 data_right.append([f_label,f_text]) 150 153 151 154 f_label = formatted_label(size=12) % _('Department') 152 f_label = Paragraph(f_label, style["Normal"])155 f_label = Paragraph(f_label, ENTRY1_STYLE) 153 156 f_text = formatted_text( 154 157 studentview.context[ 155 158 'studycourse'].certificate.__parent__.__parent__.longtitle(), 156 159 size=12) 157 f_text = Paragraph(f_text, style["Normal"])160 f_text = Paragraph(f_text, ENTRY1_STYLE) 158 161 data_right.append([f_label,f_text]) 159 162 160 163 f_label = formatted_label(size=12) % _('Faculty') 161 f_label = Paragraph(f_label, style["Normal"])164 f_label = Paragraph(f_label, ENTRY1_STYLE) 162 165 f_text = formatted_text( 163 166 studentview.context[ 164 167 'studycourse'].certificate.__parent__.__parent__.__parent__.longtitle(), 165 168 size=12) 166 f_text = Paragraph(f_text, style["Normal"])169 f_text = Paragraph(f_text, ENTRY1_STYLE) 167 170 data_right.append([f_label,f_text]) 168 171 169 172 f_label = formatted_label(size=12) % _('Entry Session') 170 f_label = Paragraph(f_label, style["Normal"])173 f_label = Paragraph(f_label, ENTRY1_STYLE) 171 174 entry_session = studentview.context['studycourse'].entry_session 172 175 entry_session = academic_sessions_vocab.getTerm(entry_session).title 173 176 f_text = formatted_text(entry_session, size=12) 174 f_text = Paragraph(f_text, style["Normal"])177 f_text = Paragraph(f_text, ENTRY1_STYLE) 175 178 data_right.append([f_label,f_text]) 176 179 … … 217 220 sig_style = [ 218 221 ('VALIGN',(0,-1),(-1,-1),'TOP'), 219 ('FONT', (0,0), (-1,-1), 'Helvetica-BoldOblique', 12),222 #('FONT', (0,0), (-1,-1), 'Helvetica-BoldOblique', 12), 220 223 ('BOTTOMPADDING', (0,0), (-1,0), 36), 221 224 ('TOPPADDING', (0,-1), (-1,-1), 0), … … 228 231 row = [] 229 232 for signature in signatures: 230 row.append( trans(_('Date:'), lang))233 row.append(Paragraph(trans(_('Date:'), lang), ENTRY1_STYLE)) 231 234 row.append('') 232 235 if len(signatures) > 1: … … 236 239 row.append('') # empty spaceholder on right 237 240 data.append(row[:-1]) 238 data.extend(([''],)* 3) # insert 3empty rows...241 data.extend(([''],)*2) # insert 2 empty rows... 239 242 row = [] 240 243 for signature in signatures: 241 row.append(Paragraph(trans(signature, lang), style["Normal"]))244 row.append(Paragraph(trans(signature, lang), ENTRY1_STYLE)) 242 245 row.append('') 243 246 data.append(row[:-1]) … … 252 255 from waeup.kofa.students.viewlets import FileManager 253 256 from waeup.kofa.browser import DEFAULT_IMAGE_PATH 254 from waeup.kofa.browser.pdf import NORMAL_STYLE, ENTRY1_STYLE255 257 style = getSampleStyleSheet() 256 258 data = [] … … 261 263 if fm.viewlets: 262 264 sc_translation = trans(_('Scanned Documents'), lang) 263 data.append(Paragraph(sc_translation, style["Heading3"]))265 data.append(Paragraph(sc_translation, HEADING_STYLE)) 264 266 # Insert list of scanned documents 265 267 table_data = [] … … 503 505 """Render pdf admission letter. 504 506 """ 505 # XXX: we have to fix the import problems here.506 from waeup.kofa.browser.interfaces import IPDFCreator507 from waeup.kofa.browser.pdf import format_html, NOTE_STYLE508 507 if student is None: 509 508 return … … 559 558 """Render pdf slips for various pages. 560 559 """ 561 # XXX: we have to fix the import problems here.562 from waeup.kofa.browser.interfaces import IPDFCreator563 from waeup.kofa.browser.pdf import NORMAL_STYLE, ENTRY1_STYLE564 560 style = getSampleStyleSheet() 565 561 creator = getUtility(IPDFCreator) … … 576 572 if student is not None: 577 573 bd_translation = trans(_('Base Data'), portal_language) 578 data.append(Paragraph(bd_translation, style["Heading3"]))574 data.append(Paragraph(bd_translation, HEADING_STYLE)) 579 575 data.append(render_student_data(studentview)) 580 576 581 577 # Insert widgets 582 578 if view.form_fields: 583 data.append(Paragraph(view.title, style["Heading3"]))579 data.append(Paragraph(view.title, HEADING_STYLE)) 584 580 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 585 581 separators = getattr(self, 'SEPARATORS_DICT', {}) … … 594 590 595 591 # Insert history 596 if filename.startswith('clearance') or filename.startswith('course'):592 if filename.startswith('clearance'): 597 593 hist_translation = trans(_('Workflow History'), portal_language) 598 data.append(Paragraph(hist_translation, style["Heading3"]))594 data.append(Paragraph(hist_translation, HEADING_STYLE)) 599 595 data.extend(creator.fromStringList(student.history.messages)) 600 596 … … 602 598 if tabledata_1 and tableheader_1: 603 599 #data.append(PageBreak()) 604 data.append(Spacer(1, 20))605 data.append(Paragraph(view.content_title_1, style["Heading3"]))600 #data.append(Spacer(1, 20)) 601 data.append(Paragraph(view.content_title_1, HEADING_STYLE)) 606 602 data.append(Spacer(1, 8)) 607 603 contenttable = render_table_data(tableheader_1,tabledata_1) … … 611 607 if tabledata_2 and tableheader_2: 612 608 #data.append(PageBreak()) 613 data.append(Spacer(1, 20))614 data.append(Paragraph(view.content_title_2, style["Heading3"]))609 #data.append(Spacer(1, 20)) 610 data.append(Paragraph(view.content_title_2, HEADING_STYLE)) 615 611 data.append(Spacer(1, 8)) 616 612 contenttable = render_table_data(tableheader_2,tabledata_2)
Note: See TracChangeset for help on using the changeset viewer.