def append(char): chars.append(char) term.save_cursor() term.move_cursor(self.puzzle.displayed_width + 60, self.puzzle.displayed_height + 3) term.write(''.join(chars[-8:])) term.restore_cursor() term.flush()
def read_command(self) -> str: self.message = None term.move_cursor(0, self.puzzle.displayed_height + 3) term.clear_rest_of_line() term.leave_raw_mode() command = input(':') term.enter_raw_mode() term.hide_cursor() # prevent cursor from briefly appearing under the colon term.flush() term.show_cursor() return command
def skip_test_blink_timing(self): import time term.set_cursor_type(1) term.move_cursor(1, 1) t = buffer.PlainText("Time!", x=0, y=0) t.draw() start = time.time() while time.time() - start < 2: term.flip() t.set("Keys!") t.draw() term.flip() for i in range(10): term.getkey()
def tearDown(self): term.move_cursor(x=0, y=max(0, self.height-8)) term.reset()
def render(self) -> None: term.clear_screen() term.move_cursor(0, 0) term.write(term.bold(self.data.title)) term.move_cursor(0, 1) term.write(self.data.author) for y, line in enumerate(self.puzzle.render_grid(self.cursor), start=2): term.move_cursor(0, y) term.write(line) for direction, x_offset in zip(Direction, (2, 36)): for y, line in enumerate(self.puzzle.render_clues(self.cursor, direction), start=2): term.move_cursor(self.puzzle.displayed_width + x_offset, y) term.write(line) if self.message is not None: term.move_cursor(0, self.puzzle.displayed_height + 3) term.write(self.message) x, y = self.cursor.displayed_coords() term.move_cursor(x, y + 2) term.flush()
def tearDown(self): term.move_cursor(x=0, y=max(0, self.height - 8)) term.reset()