Esempio n. 1
0
 def show_log(self):
     if self.questions:
         q = self.questions[0]
         log = q.html_log
         if q.log_is_file:
             with open(log, 'rb') as f:
                 log = f.read().decode('utf-8')
         self.log_viewer = ViewLog(q.log_viewer_title, log, parent=self)
Esempio n. 2
0
    def sum_columns_finish(self, book_list, sum_cols=[]):
        #print("sum_cols:%s"%sum_cols)
        #print("book_list:%s"%book_list)

        values = []
        for j, x in enumerate(sum_cols):
            values.append([
                x['name'],
                "%s" % len(x['values']),
                self.do_sum(x),
                self.do_average(x),
                self.do_median(x),
                self.do_stddev(x)
            ])

        d = ViewLog(_("Column Sums"), "", parent=self.gui)
        # override ViewLog's default of wrapping content with <pre>
        html = '''<table border='1'><tr><th>Column</th><th>Book Count</th><th>Sum</th><th>Average</th><th>Median</th><th>Std Dev</th></tr>'''
        for row in values:
            html += "<tr><td align='right'>" + (
                "</td><td align='right'>".join(row)) + "</td></tr>"
        html += "</table>"
        d.tb.setHtml(html)
        d.setWindowIcon(get_icon('bookmarks.png'))
        d.exec_()