def repaint(self, event: Event): ctx = DrawingContext(self.image) ctx.border(tm=1, bm=1) cols = self.image.size.width extra_cols = 0 if cols > 80: extra_cols = cols - 80 ctx.attributes.style = REVERSE ctx.print(' ' * cols) ctx.move_to(1, 0) bottom = self.top + self.image.size.height - 4 ctx.print(self.title) ctx.move_to(1, self.image.size.height - 1) ctx.attributes.style = UNDERLINE ctx.print("Enter") ctx.move_to(6, self.image.size.height - 1) ctx.attributes.style = NORMAL ctx.print(": Expand/Collapse") ctx.move_to(27, self.image.size.height - 1) ctx.attributes.style = UNDERLINE ctx.print("S") ctx.move_to(28, self.image.size.height - 1) ctx.attributes.style = NORMAL ctx.print("elect All") ctx.move_to(41, self.image.size.height - 1) ctx.attributes.style = UNDERLINE ctx.print("D") ctx.move_to(42, self.image.size.height - 1) ctx.attributes.style = NORMAL ctx.print("eselect All") ctx.move_to(66 + extra_cols, self.image.size.height - 1) ctx.print("Start ") ctx.move_to(72 + extra_cols, self.image.size.height - 1) ctx.attributes.style = UNDERLINE ctx.print("T") ctx.move_to(73 + extra_cols, self.image.size.height - 1) ctx.attributes.style = NORMAL ctx.print("esting") for i, line in enumerate(self.tree.render(cols - 3)[self.top:bottom]): ctx.move_to(2, i + 2) if i != self.highlight: ctx.attributes.style = NORMAL else: # highlight the current line ctx.attributes.style = REVERSE ctx.print(line)
def repaint(self, event: Event): ctx = DrawingContext(self.image) ctx.border(tm=1) ctx.attributes.style = REVERSE ctx.print(' ' * self.image.size.width) ctx.move_to(1, 0) ctx.print(self.title) # Display all the menu items for i in range(self.option_count): ctx.attributes.style = NORMAL if i == self.position: ctx.attributes.style = REVERSE # Display options from line 3, column 4 ctx.move_to(4, 3 + i) ctx.print("[{}] - {}".format( 'X' if i in self.selection else ' ', self.menu[i].replace('ihv-', '').capitalize())) # Display "OK" at bottom of menu ctx.attributes.style = NORMAL if self.position == self.option_count: ctx.attributes.style = REVERSE # Add an empty line before the last option ctx.move_to(4, 4 + self.option_count) ctx.print("< OK >")
def repaint(self, event: Event): ctx = DrawingContext(self.image) i = 0 ctx.border() for paragraph in self.text.splitlines(): i += 1 for line in textwrap.fill(paragraph, self.image.size.width - 8, replace_whitespace=False).splitlines(): ctx.move_to(4, i) ctx.print(line) i += 1 ctx.move_to(4, i + 1) ctx.attributes.style = REVERSE ctx.print("< Continue >")
def repaint(self, event: Event): ctx = DrawingContext(self.image) i = 0 ctx.border() for paragraph in self.text.splitlines(): i += 1 for line in textwrap.fill( paragraph, self.image.size.width - 8, replace_whitespace=False).splitlines(): ctx.move_to(4, i) ctx.print(line) i += 1 ctx.move_to(4, i + 1) ctx.attributes.style = REVERSE ctx.print("< Continue >")