def __init__(self, parent_mode, title, message, align=ALIGN.DEFAULT, height_req=0.75, width_req=0.5, **kwargs): self.message = message Popup.__init__(self, parent_mode, title, align=align, height_req=height_req, width_req=width_req) BaseInputPane.__init__(self, self, immediate_action=True, **kwargs) lns = format_utils.wrap_string(self.message, self.width - 3, 3, True) if isinstance(self.height_req, float): self.height_req = min( len(lns) + 2, int(parent_mode.rows * self.height_req)) self.handle_resize() self.no_refresh = False self.add_text_area('TextMessage', message)
def render(self, screen, row, col=0, **kwargs): util.safe_curs_set(util.Curser.INVISIBLE) # Make cursor invisible when text field is active color = '{!white,black!}' lines = wrap_string(self.txt, self.parent.width - 3, 3, True) for i, line in enumerate(lines): self.parent.add_string(row + i, '%s%s' % (color, line), scr=screen, col=col, pad=False, trim=False) return len(lines)
def render(self, screen, row, col=0, **kwargs): util.safe_curs_set(util.Curser.INVISIBLE ) # Make cursor invisible when text field is active color = '{!white,black!}' lines = wrap_string(self.txt, self.parent.width - 3, 3, True) for i, line in enumerate(lines): self.parent.add_string(row + i, '%s%s' % (color, line), scr=screen, col=col, pad=False, trim=False) return len(lines)
def height(self): lines = wrap_string(self.txt, self.parent.width - 3, 3, True) return len(lines)