Beispiel #1
0
    def table(self, table):
        prefix = u"      "
        if self.current_rule:
            prefix += u"  "

        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write("      %s\n" % comment.value)
            self.stream.write(u"%s|" % prefix)
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(" ")
                self.stream.write(self.color(cell, None, j))
                self.stream.write(" " * (max_length - cell_lengths[i][j]))
                self.stream.write(" |")
            self.stream.write("\n")
        self.stream.flush()
Beispiel #2
0
    def table(self, table, strformat=unicode):
        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write('      %s\n' % comment.value)
            self.stream.write('      |')
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(' ')
                self.stream.write(strformat(cell))
                self.stream.write(' ' * (max_length - cell_lengths[i][j]))
                self.stream.write(' |')
            self.stream.write('\n')
        self.stream.flush()

        table_width = 7 + 3 * len(table.headings) + sum(max_lengths)
        self.table_lines = len(all_rows) * (1 + table_width // self.display_width)
Beispiel #3
0
 def color(self, cell, statuses, color):
     __pychecker__ = "unusednames=color"
     if statuses:
         # XXX-JE-OOPS: Coloring without textual content ?!?
         return escapes[color] + escapes['reset']
     else:
         return escape_cell(cell)
Beispiel #4
0
    def table(self, table, strformat=unicode):
        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write('      %s\n' % comment.value)
            self.stream.write('      |')
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(' ')
                self.stream.write(strformat(cell))
                self.stream.write(' ' * (max_length - cell_lengths[i][j]))
                self.stream.write(' |')
            self.stream.write('\n')
        self.stream.flush()

        table_width = 7 + 3 * len(table.headings) + sum(max_lengths)
        self.table_lines = len(all_rows) * (1 +
                                            table_width // self.display_width)
Beispiel #5
0
    def table(self, table):
        prefix = u"      "
        if self.current_rule:
            prefix += u"  "

        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write("      %s\n" % comment.value)
            self.stream.write(u"%s|" % prefix)
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(" ")
                self.stream.write(self.color(cell, None, j))
                self.stream.write(" " * (max_length - cell_lengths[i][j]))
                self.stream.write(" |")
            self.stream.write("\n")
        self.stream.flush()
Beispiel #6
0
    def table(self, table):
        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write('      %s\n' % comment.value)
            self.stream.write('      |')
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(' ')
                self.stream.write(self.color(cell, None, j))
                self.stream.write(' ' * (max_length - cell_lengths[i][j]))
                self.stream.write(' |')
            self.stream.write('\n')
        self.stream.flush()
Beispiel #7
0
    def table(self, table):
        cell_lengths = []
        all_rows = [table.headings] + table.rows
        for row in all_rows:
            lengths = [len(escape_cell(c)) for c in row]
            cell_lengths.append(lengths)

        max_lengths = []
        for col in range(0, len(cell_lengths[0])):
            max_lengths.append(max([c[col] for c in cell_lengths]))

        for i, row in enumerate(all_rows):
            #for comment in row.comments:
            #    self.stream.write('      %s\n' % comment.value)
            self.stream.write('      |')
            for j, (cell, max_length) in enumerate(zip(row, max_lengths)):
                self.stream.write(' ')
                self.stream.write(self.color(cell, None, j))
                self.stream.write(' ' * (max_length - cell_lengths[i][j]))
                self.stream.write(' |')
            self.stream.write('\n')
        self.stream.flush()
Beispiel #8
0
 def color(self, cell, statuses, color):
     if statuses:
         return escapes['color'] + escapes['reset']
     else:
         return escape_cell(cell)
 def color(self, cell, statuses, _color):  # pylint: disable=no-self-use
     if statuses:
         return escapes["color"] + escapes["reset"]
     # -- OTHERWISE:
     return escape_cell(cell)
Beispiel #10
0
 def color(self, cell, statuses, color):
     if statuses:
         return escapes['color'] + escapes['reset']
     else:
         return escape_cell(cell)
Beispiel #11
0
 def color(self, cell, statuses, _color):  # pylint: disable=no-self-use
     if statuses:
         return escapes["color"] + escapes["reset"]
     # -- OTHERWISE:
     return escape_cell(cell)
Beispiel #12
0
 def color(self, cell, statuses, color):
     if statuses:
         return escapes["color"] + escapes["reset"]
     else:
         return escape_cell(cell)