• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python canvas.CompositeCanvas类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中urwid.canvas.CompositeCanvas的典型用法代码示例。如果您正苦于以下问题:Python CompositeCanvas类的具体用法?Python CompositeCanvas怎么用?Python CompositeCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CompositeCanvas类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: render

 def render(self, size, focus=False):
     fixed_size(size) # complain if parameter is wrong
     a = None
     ai = ak = 0
     o = []
     rows = self.font.height
     attrib = self.attrib+[(None,len(self.text))]
     for ch in self.text:
         if not ak:
             a, ak = attrib[ai]
             ai += 1
         ak -= 1
         width = self.font.char_width(ch)
         if not width: 
             # ignore invalid characters
             continue
         c = self.font.render(ch)
         if a is not None:
             c = CompositeCanvas(c)
             c.fill_attr(a)
         o.append((c, None, False, width))
     if o:
         canv = CanvasJoin(o)
     else:
         canv = TextCanvas([""]*rows, maxcol=0, 
             check_width=False)
         canv = CompositeCanvas(canv)
     canv.set_depends([])
     return canv
开发者ID:jmcb,项目名称:urwid,代码行数:29,代码来源:graphics.py


示例2: finalize_render

 def finalize_render(self, size, focus=False):
     canv = fn(self, size, focus=focus)
     if canv.widget_info:
         canv = CompositeCanvas(canv)
     validate_size(self, size, canv)
     canv.finalize(self, size, focus)
     return canv
开发者ID:sporkexec,项目名称:urwid,代码行数:7,代码来源:widget.py


示例3: render

 def render(self, size, focus=False):
     canv = self.__super.render(size, focus)
     if self._pop_up_widget:
         canv = CompositeCanvas(canv)
         canv.set_pop_up(self._pop_up_widget,
                         **self.get_pop_up_parameters())
     return canv
开发者ID:horazont,项目名称:urwid,代码行数:7,代码来源:wimp.py


示例4: render

 def render(self, size, focus=False):
     """
     Render wrapped widget and apply attribute. Return canvas.
     """
     attr_map = self._attr_map
     if focus and self._focus_map is not None:
         attr_map = self._focus_map
     canv = self._original_widget.render(size, focus=focus)
     canv = CompositeCanvas(canv)
     canv.fill_attr_apply(attr_map)
     return canv
开发者ID:0xPr0xy,项目名称:soundcloud-cli,代码行数:11,代码来源:decoration.py


示例5: render

    def render(self, size, focus=False):
        """Render top_w overlayed on bottom_w."""
        left, right, top, bottom = self.calculate_padding_filler(size, focus)
        bottom_c = self.bottom_w.render(size)
        top_c = self.top_w.render(self.top_w_size(size, left, right, top, bottom), focus)
        top_c = CompositeCanvas(top_c)
        if left < 0 or right < 0:
            top_c.pad_trim_left_right(min(0, left), min(0, right))
        if top < 0 or bottom < 0:
            top_c.pad_trim_top_bottom(min(0, top), min(0, bottom))

        return CanvasOverlay(top_c, bottom_c, left, top)
开发者ID:0xPr0xy,项目名称:blogger-cli,代码行数:12,代码来源:container.py


示例6: cached_render

    def cached_render(self, size, focus=False):
        focus = focus and not ignore_focus
        canv = CanvasCache.fetch(self, cls, size, focus)
        if canv:
            return canv

        canv = fn(self, size, focus=focus)
        validate_size(self, size, canv)
        if canv.widget_info:
            canv = CompositeCanvas(canv)
        canv.finalize(self, size, focus)
        CanvasCache.store(cls, canv)
        return canv
开发者ID:sporkexec,项目名称:urwid,代码行数:13,代码来源:widget.py


示例7: render

    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))
        if not combinelist:
            return SolidCanvas(" ", size[0], size[1])

        c = CanvasCombine(combinelist)
        if maxrow - rows:
            c.pad_trim_top_bottom(0, maxrow - rows)
        return c
开发者ID:Julian,项目名称:urwid,代码行数:29,代码来源:graphics.py


示例8: render

    def render(self, size, focus=False):
        """
        Render the text content of this widget with a cursor when
        in focus.

        >>> si = SelectableIcon(u"[!]")
        >>> si
        <SelectableIcon selectable flow widget '[!]'>
        >>> si.render((4,), focus=True).cursor
        (1, 0)
        >>> si = SelectableIcon("((*))", 2)
        >>> si.render((8,), focus=True).cursor
        (2, 0)
        >>> si.render((2,), focus=True).cursor
        (0, 1)
        """
        c = self.__super.render(size, focus)
        if focus:
            # create a new canvas so we can add a cursor
            c = CompositeCanvas(c)
            c.cursor = self.get_cursor_coords(size)
        return c
开发者ID:eykd,项目名称:urwid,代码行数:22,代码来源:wimp.py


示例9: render

    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)
        """
        (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
开发者ID:sporkexec,项目名称:urwid,代码行数:24,代码来源:widget.py



注:本文中的urwid.canvas.CompositeCanvas类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compat.bytes函数代码示例发布时间:2022-05-27
下一篇:
Python urwid.WidgetWrap类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap