def render(self, xxx_todo_changeme1, focus=False): (maxcol, ) = xxx_todo_changeme1 lines, r = self.cols(maxcol) return CanvasJoin([ (Text.render(self, (lines, ), focus), None, True, maxcol - r), (self.info.render((r, )), None, False, r), ])
def render(self, size, focus=False): """ Render edit widget and return canvas. Include cursor when in focus. >>> c = Edit("? ","yes").render((10,), focus=True) >>> c.text # ... = b in Python 3 [...'? yes '] >>> c.cursor (5, 0) """ if self.has_focus and not focus: self.has_focus = False self.on_blur() self.has_focus = focus (maxcol,) = size self._shift_view_to_cursor = bool(focus) canv = Text.render(self,(maxcol,)) if focus: canv = CompositeCanvas(canv) canv.cursor = self.get_cursor_coords((maxcol,)) # .. will need to FIXME if I want highlight to work again #if self.highlight: # hstart, hstop = self.highlight_coords() # d.coords['highlight'] = [ hstart, hstop ] return canv
def render(self, xxx_todo_changeme, focus=False): (maxcol, ) = xxx_todo_changeme lines, r = self.cols(maxcol) return CanvasJoin([ Text.render(self, (lines, ), focus), maxcol - r, self.info.render((r, )), ])
self.info.set_text(self.format % args) def cols(self, maxcol): l = len(self.get_text()[0]) r = len(self.info.get_text()[0]) lr = l + r mc = maxcol - 2 if lr <= mc: return l, r return l * mc // lr, r * mc // lr if urwid_ver < '0.9.8': def render(self, (maxcol,), focus=False): l, r = self.cols(maxcol) return CanvasJoin([ Text.render(self, (l,), focus), maxcol - r, self.info.render((r,)), ]) else: def render(self, (maxcol,), focus=False): l, r = self.cols(maxcol) return CanvasJoin([ (Text.render(self, (l,), focus), None, True, maxcol - r), (self.info.render((r,)), None, False, r), ]) def rows(self, (maxcol,), focus=False): l, r = self.cols(maxcol) return max(Text.rows(self, (l,), focus), self.info.rows((r,)))