Changeset 10328 for main/waeup.kofa


Ignore:
Timestamp:
21 Jun 2013, 07:23:42 (11 years ago)
Author:
Henrik Bettermann
Message:

Do not modify table_style in _getWidgetsTableData. Otherwise we can't split table_data into two tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py

    r10319 r10328  
    623623
    624624    def _getWidgetsTableData(self, widgets, separators, domain,
    625                              lang, table_style, twoDataCols):
     625                             lang, twoDataCols):
    626626        row_num = 0
    627627        table_data = []
    628628        for widget in widgets:
    629             # We do not render headlines in multi-column design
    630             if twoDataCols is False and separators and separators.get(widget.name):
     629            if separators and separators.get(widget.name):
    631630                f_headline = translate(
    632631                    separators[widget.name], domain, target_language=lang)
    633632                f_headline = Paragraph(f_headline, HEADLINE1_STYLE)
    634633                table_data.append([f_headline])
    635                 table_style.append(('SPAN', (0,row_num), (-1,row_num)),)
    636                 table_style.append(
    637                     ('TOPPADDING', (0,row_num), (-1,row_num), 12),)
    638634                row_num += 1
    639635            f_label = translate(widget.label.strip(), domain,
     
    648644            table_data.append([f_label,f_text])
    649645            row_num += 1
    650         return table_data, row_num, table_style
     646        return table_data, row_num
    651647
    652648    def getWidgetsTable(self, form_fields, context, view, lang='en',
     
    688684
    689685        # Determine table data
    690         table_data, row_num, table_style = self._getWidgetsTableData(
    691             widgets, separators, domain, lang, table_style, twoDataCols)
     686        table_data, row_num = self._getWidgetsTableData(
     687            widgets, separators, domain, lang, twoDataCols)
    692688
    693689        # Add course (admitted, etc.) if applicable
     
    699695            table_data, row_num, dept, faculty, lang, domain)
    700696
    701         # render two-column table of tables
     697        # render two-column table of tables if applicable
    702698        lines = len(table_data)
    703699        middle = lines/2
    704700        if twoDataCols is True and lines > 2:
    705             table_left = Table(table_data[:middle+1],
    706                                style=table_style, colWidths=[5*cm, 4*cm])
    707             table_right = Table(table_data[middle+1:],
    708                                 style=table_style, colWidths=[5*cm, 4*cm])
    709             table_style.append(('LEFTPADDING', (0,0), (0,-1), 3*cm),)
     701            table_left = Table(table_data[:middle],
     702                               style=table_style, colWidths=[4*cm, 5*cm])
     703            table_right = Table(table_data[middle:],
     704                                style=table_style, colWidths=[4*cm, 5*cm])
     705            table_style.append(('LEFTPADDING', (0,0), (0,-1), 3.147*cm),)
    710706            table = Table([[table_left, table_right],],style=table_style)
    711707            return table
Note: See TracChangeset for help on using the changeset viewer.