當前位置: 首頁>>代碼示例>>Python>>正文


Python display_common.AttrSpec類代碼示例

本文整理匯總了Python中urwid.display_common.AttrSpec的典型用法代碼示例。如果您正苦於以下問題:Python AttrSpec類的具體用法?Python AttrSpec怎麽用?Python AttrSpec使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AttrSpec類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: reverse_attrspec

 def reverse_attrspec(self, attrspec, undo=False):
     """
     Put standout mode to the 'attrspec' given and remove it if 'undo' is
     True.
     """
     if attrspec is None:
         attrspec = AttrSpec('default', 'default')
     attrs = [fg.strip() for fg in attrspec.foreground.split(',')]
     if 'standout' in attrs and undo:
         attrs.remove('standout')
         attrspec.foreground = ','.join(attrs)
     elif 'standout' not in attrs and not undo:
         attrs.append('standout')
         attrspec.foreground = ','.join(attrs)
     return attrspec
開發者ID:aiminickwong,項目名稱:ovirt_config,代碼行數:15,代碼來源:vterm.py

示例2: get_cols_rows

    def get_cols_rows(self):
        """Return the next screen size in HtmlGenerator.sizes."""
        if not self.sizes:
            raise HtmlGeneratorSimulationError, "Ran out of screen sizes to return!"
        return self.sizes.pop(0)

    def get_input(self, raw_keys=False):
        """Return the next list of keypresses in HtmlGenerator.keys."""
        if not self.keys:
            raise ExitMainLoop()
        if raw_keys:
            return (self.keys.pop(0), [])
        return self.keys.pop(0)

_default_aspec = AttrSpec(_default_foreground, _default_background)
(_d_fg_r, _d_fg_g, _d_fg_b, _d_bg_r, _d_bg_g, _d_bg_b) = (
    _default_aspec.get_rgb_values())

def html_span(s, aspec, cursor = -1):
    fg_r, fg_g, fg_b, bg_r, bg_g, bg_b = aspec.get_rgb_values()
    # use real colours instead of default fg/bg
    if fg_r is None:
        fg_r, fg_g, fg_b = _d_fg_r, _d_fg_g, _d_fg_b
    if bg_r is None:
        bg_r, bg_g, bg_b = _d_bg_r, _d_bg_g, _d_bg_b
    html_fg = "#%02x%02x%02x" % (fg_r, fg_g, fg_b)
    html_bg = "#%02x%02x%02x" % (bg_r, bg_g, bg_b)
    if aspec.standout:
        html_fg, html_bg = html_bg, html_fg
    extra = (";text-decoration:underline" * aspec.underline +
開發者ID:KennethNielsen,項目名稱:urwid,代碼行數:30,代碼來源:html_fragment.py

示例3: rgb_values

 def rgb_values(n):
     if self.colors == 16:
         aspec = AttrSpec("h%d"%n, "", 256)
     else:
         aspec = AttrSpec("h%d"%n, "", self.colors)
     return aspec.get_rgb_values()[:3]
開發者ID:AnyMesh,項目名稱:anyMesh-Python,代碼行數:6,代碼來源:raw_display.py


注:本文中的urwid.display_common.AttrSpec類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。