Exemple #1
0
 def __str__(self):
     """Generate HTML for the entire table and caption.
     """
     self.normalize()  #calculate the scaling of the data
     self.table.prepend(Caption(Bold(self.title)))  #add title as caption
     for item in self.datalist:
         row = TR()
         # 1st cell is the text description
         row.append(
             TD(item['label'],
                align='left',
                width=70,
                bgcolor=self.label_shade))
         # 2nd cell is the decimal sum value
         row.append(
             TD("%9.1f" % item['total'],
                align='right',
                width=70,
                bgcolor=self.value_shade))
         # 3rd cell contains the scaled bar graphic
         row.append(self.make_bar_cell(item))
         self.table.append(row)  # add the row to the table
     # now tack on a legend at the bottom
     self.table.append(
         TR(
             TD('AVERAGE', align='left', width=70,
                bgcolor=self.label_shade),
             TD("%9.1f" % self.average,
                align='right',
                width=70,
                bgcolor=self.value_shade),
             TD(self.gen_legend(),
                bgcolor=self.label_shade,
                html_escape="OFF")))
     return str(self.table)
Exemple #2
0
 def make_row(self):
     if self.weekday in ('Saturday', 'Sunday'):
         row = TR(bgcolor=WEEKENDCOLOR)
     else:
         row = TR(bgcolor=WEEKDAYCOLOR)
     row.append(TD(self.repr_date_cell(), align='right', html_escape='off'))
     row.append(TD(self.repr_appt_cell(), html_escape='off'))
     return row
 def __str__(self):
     """Generate HTML for the entire table and caption.
     """
     self.normalize() #calculate the scaling of the data
     self.table.prepend(Caption(Bold(self.title))) #add title as caption
     for item in self.datalist:
         row = TR()
         # 1st cell is the text description
         row.append(TD(item['label'], align='left', width=70,
                       bgcolor = self.label_shade))
         # 2nd cell is the decimal sum value
         row.append(TD("%9.1f"%item['total'], align='right',
                       width=70, bgcolor=self.value_shade))
         # 3rd cell contains the scaled bar graphic
         row.append(self.make_bar_cell(item))
         self.table.append(row) # add the row to the table
     # now tack on a legend at the bottom
     self.table.append(TR( TD('AVERAGE', align='left', width=70,
                              bgcolor = self.label_shade),
                           TD("%9.1f" % self.average, align='right',
                              width=70, bgcolor=self.value_shade), 
                           TD(self.gen_legend(),
                              bgcolor=self.label_shade,
                              html_escape="OFF")))
     return str(self.table)
 def make_row(self):
     if self.weekday in ('Saturday','Sunday'):
         row = TR(bgcolor=WEEKENDCOLOR)
     else:
         row = TR(bgcolor=WEEKDAYCOLOR)
     row.append(TD(self.repr_date_cell(), align='right',html_escape='off'))
     row.append(TD(self.repr_appt_cell(),html_escape='off'))
     return row