- Timestamp:
- 13 Nov 2014, 13:21:59 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/kofa/browser/pdf.py
r10595 r11947 566 566 567 567 @classmethod 568 def _addCourse(cls, table_data, row_num, course_label, course_link,569 lang, domain):570 """Add course data to `table_data`.571 """572 if not course_label or not course_link:573 return table_data, row_num574 f_label= translate(575 _(course_label), domain, target_language=lang)576 f_label = Paragraph(f_label, ENTRY1_STYLE)577 f_text = Paragraph(course_link, ENTRY1_STYLE)578 table_data.append([f_label, f_text])579 row_num += 1580 return table_data, row_num581 582 @classmethod583 def _addDeptAndFaculty(cls, table_data, row_num, dept, faculty,584 lang, domain):585 """Add `dept` and `faculty` as table rows to `table_data`.586 587 `dept` and `faculty` are expected to be strings or None. In588 latter case they are not put into the table.589 """590 for label, text in (('Department:', dept), ('Faculty:', faculty)):591 if text is None:592 continue593 label = translate(_(label), domain, target_language=lang)594 table_data.append([595 Paragraph(label, ENTRY1_STYLE),596 Paragraph(text, ENTRY1_STYLE)])597 row_num += 1598 return table_data, row_num599 600 @classmethod601 568 def _drawSignatureBoxes(cls, canvas, width, height, signatures=[]): 602 569 """Draw signature boxes into canvas. … … 661 628 def getWidgetsTable(self, form_fields, context, view, lang='en', 662 629 domain='waeup.kofa', separators=None, 663 course_label=None, course_link=None, dept=None, 664 faculty=None, colWidths=None, twoDataCols=False): 630 colWidths=None, twoDataCols=False): 665 631 """Return a reportlab `Table` instance, created from widgets 666 632 determined by `form_fields` and `context`. … … 679 645 - `separators` 680 646 a list of separators. 681 - `course_label` and `course_link`682 if a course should be added to the table, `course_label`683 and `course_link` can be given, both being strings. They684 will be rendered in an extra-row.685 - `dept` and `faculty`686 if these are given, we render extra rows with faculty and687 department.688 647 - `colWidths` 689 648 defines the the column widths of the data in the right column … … 699 658 table_data, row_num = self._getWidgetsTableData( 700 659 widgets, separators, domain, lang, twoDataCols) 701 702 # Add course (admitted, etc.) if applicable703 table_data, row_num = self._addCourse(704 table_data, row_num, course_label, course_link, lang, domain,)705 706 ## Add dept. and faculty if applicable707 table_data, row_num = self._addDeptAndFaculty(708 table_data, row_num, dept, faculty, lang, domain)709 660 710 661 # render two-column table of tables if applicable
Note: See TracChangeset for help on using the changeset viewer.