Пример #1
0
    def move_to(self, from_key, to_key):
        idx_from = self.get_cell_index(from_key)
        idx_to = self.get_cell_index(to_key)

        y = (idx_from - idx_to) * self.cell_height

        if y > 0:
            ansi.down(y)
        elif y < 0:
            ansi.up(-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)