Esempio n. 1
0
 def render(self, size, focus=False):
     """Render self.original_widget with space above and/or below."""
     (maxcol, maxrow) = size
     top, bottom = self.filler_values(size, focus)
     
     if self.height_type is None:
         canv = self._original_widget.render((maxcol,), focus)
     else:
         canv = self._original_widget.render((maxcol,maxrow-top-bottom),focus)
     canv = CompositeCanvas(canv)
     
     if maxrow and canv.rows() > maxrow and canv.cursor is not None:
         cx, cy = canv.cursor
         if cy >= maxrow:
             canv.trim(cy-maxrow+1,maxrow-top-bottom)
     if canv.rows() > maxrow:
         canv.trim(0, maxrow)
         return canv
     canv.pad_trim_top_bottom(top, bottom)
     return canv
Esempio n. 2
0
    def render(self, size, focus=False):
        """
        Render GraphVScale.
        """
        (maxcol, maxrow) = size
        pl = scale_bar_values( self.pos, self.top, maxrow )

        combinelist = []
        rows = 0
        for p, t in zip(pl, self.txt):
            p -= 1
            if p >= maxrow: break
            if p < rows: continue
            c = t.render((maxcol,))
            if p > rows:
                run = p-rows
                c = CompositeCanvas(c)
                c.pad_trim_top_bottom(run, 0)
            rows += c.rows()
            combinelist.append((c, None, False))
        c = CanvasCombine(combinelist)
        if maxrow - rows:
            c.pad_trim_top_bottom(0, maxrow - rows)
        return c