예제 #1
0
    def add_cell(self, key):
        if not key in self.cell_keys:
            self.cell_keys.insert(0, key)

            y = self.cell_height
            # if this is the first key
            if len(self.cell_keys) == 1:
                y = self.cell_height - 1

            ansi.write('\n' * y)
            ansi.move_horizontal(self.term_width)
예제 #2
0
    def display(self, msg):
        key, rows = self.render(msg)

        # add a row to our table
        self.add_cell(key)

        # display rows
        self.move_from_the_bottom_to(key)
        ansi.up(2)
        for i, row in enumerate(rows):
            ansi.move_horizontal(0)
            if i > 0:
                ansi.down(1)
            ansi.clear_line()
            ansi.write(row)
            ansi.move_horizontal(self.term_width)
        self.move_to_the_bottom_from(key)