Changeset 10310 for main/waeup.kofa/trunk
- Timestamp:
- 17 Jun 2013, 07:00:04 (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/applicants/pdf.py
r10222 r10310 20 20 """ 21 21 import grok 22 from reportlab.platypus import Paragraph, Spacer 22 from reportlab.platypus import Paragraph, Spacer, Table 23 from reportlab.lib.units import cm 23 24 from zope.component import getUtility 24 25 from zope.i18n import translate … … 26 27 from waeup.kofa.browser import DEFAULT_PASSPORT_IMAGE_PATH 27 28 from waeup.kofa.browser.interfaces import IPDFCreator 28 from waeup.kofa.browser.pdf import SMALL_PARA_STYLE 29 from waeup.kofa.browser.pdf import SMALL_PARA_STYLE, ENTRY1_STYLE 29 30 from waeup.kofa.interfaces import IExtFileStore, IPDF, IKofaUtils 30 31 from waeup.kofa.interfaces import MessageFactory as _ 31 32 from waeup.kofa.widgets.datewidget import FriendlyDateDisplayWidget 33 34 SLIP_STYLE = [ 35 ('VALIGN',(0,0),(-1,-1),'TOP'), 36 #('FONT', (0,0), (-1,-1), 'Helvetica', 11), 37 ] 32 38 33 39 class PDFApplicationSlip(grok.Adapter): … … 42 48 43 49 form_fields = grok.AutoFields(IApplicant).omit( 44 'locked', 'course_admitted') 50 'locked', 'course_admitted', 'suspended', 51 ) 45 52 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 53 column_two_fields = ('applicant_id', 'reg_number', 54 'firstname', 'middlename', 'lastname') 46 55 47 56 @property … … 122 131 data.append(Spacer(1, 20)) 123 132 124 # append photograph 133 # create two-column header table 134 data_left = [] 135 data_right = [] 136 # append photograph to the left 125 137 img_path = getattr( 126 138 getUtility(IExtFileStore).getFileByContext(self.context), 127 139 'name', DEFAULT_PASSPORT_IMAGE_PATH) 128 data.append(creator.getImage(img_path)) 140 data_left.append([creator.getImage(img_path)]) 141 table_left = Table(data_left,style=SLIP_STYLE) 142 # append column-two fields to the right 143 fields = [ 144 field for field in self.form_fields 145 if field.__name__ in self.column_two_fields] 146 table_right = creator.getWidgetsTable( 147 fields, self.context, None, lang=portal_language, 148 separators=None, colWidths=[5*cm, 6*cm]) 149 header_table = Table([[table_left, table_right],],style=SLIP_STYLE) 150 data.append(header_table) 151 129 152 data.append(Spacer(1, 12)) 130 153 131 # append widgets 154 # append widgets except those already added in column two 132 155 dept, faculty = self._getDeptAndFaculty() 156 fields = [ 157 field for field in self.form_fields 158 if not field.__name__ in self.column_two_fields] 133 159 data.append(creator.getWidgetsTable( 134 self.form_fields, self.context, view, lang=portal_language,160 fields, self.context, view, lang=portal_language, 135 161 domain='waeup.kofa', separators=separators, 136 162 course_label='Admitted Course of Study:', -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r9980 r10310 625 625 domain='waeup.kofa', separators=None, 626 626 course_label=None, course_link=None, dept=None, 627 faculty=None ):627 faculty=None, colWidths=None): 628 628 """Return a reportlab `Table` instance, created from widgets 629 629 determined by `form_fields` and `context`. … … 687 687 688 688 # Create table 689 table = Table(table_data,style=table_style) #, rowHeights=14) 689 table = Table( 690 table_data,style=table_style, colWidths=colWidths) #, rowHeights=14) 690 691 table.hAlign = 'LEFT' 691 692 return table
Note: See TracChangeset for help on using the changeset viewer.