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

Python theming.to_curses_attr函数代码示例

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

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



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

示例1: write_contact_jid

 def write_contact_jid(self, jid):
     """
     Just write the jid that we are talking to
     """
     self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
     self.addstr(jid.full, to_curses_attr(get_theme().COLOR_CONVERSATION_NAME))
     self.addstr('] ', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
开发者ID:krackou,项目名称:poezio,代码行数:7,代码来源:info_wins.py


示例2: refresh

 def refresh(self):
     with g_lock:
         self._win.erase()
         self._win.attron(to_curses_attr(self.color))
         self.addstr(0, 0, self.text)
         self._win.attroff(to_curses_attr(self.color))
         self._refresh()
开发者ID:adamkijak,项目名称:poezio,代码行数:7,代码来源:data_forms.py


示例3: write_nack

 def write_nack(self):
     color = get_theme().COLOR_CHAR_NACK
     self._win.attron(to_curses_attr(color))
     self.addstr(get_theme().CHAR_NACK)
     self._win.attroff(to_curses_attr(color))
     self.addstr(' ')
     return poopt.wcswidth(get_theme().CHAR_NACK) + 1
开发者ID:fmeynadier,项目名称:poezio,代码行数:7,代码来源:text_win.py


示例4: rewrite_text

 def rewrite_text(self):
     """
     Refresh the line onscreen, but first, always adjust the
     view_pos.  Also, each FORMAT_CHAR+attr_char count only take
     one screen column (this is done in addstr_colored_lite), we
     have to do some special calculations to find the correct
     length of text to display, and the position of the cursor.
     """
     self.adjust_view_pos()
     text = self.text
     self._win.erase()
     if self.color:
         self._win.attron(to_curses_attr(self.color))
     displayed_text = text[self.view_pos:self.view_pos+self.width-1].replace('\t', '\x18')
     self._win.attrset(0)
     self.addstr_colored_lite(displayed_text)
     # Fill the rest of the line with the input color
     if self.color:
         (_, x) = self._win.getyx()
         size = self.width - x
         self.addnstr(' ' * size, size, to_curses_attr(self.color))
     self.addstr(0,
             poopt.wcswidth(displayed_text[:self.pos-self.view_pos]), '')
     if self.color:
         self._win.attroff(to_curses_attr(self.color))
     curses.curs_set(1)
     self._refresh()
开发者ID:fmeynadier,项目名称:poezio,代码行数:27,代码来源:inputs.py


示例5: write_contact_informations

 def write_contact_informations(self, contact):
     """
     Write the informations about the contact
     """
     if not contact:
         self.addstr("(contact not in roster)", to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
         return
     display_name = contact.name
     if display_name:
         self.addstr('%s '%(display_name), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
开发者ID:krackou,项目名称:poezio,代码行数:10,代码来源:info_wins.py


示例6: refresh

 def refresh(self, name=None, window=None):
     log.debug('Refresh: %s', self.__class__.__name__)
     self._win.erase()
     if name:
         self.addstr(name, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
     else:
         self.addstr(self.message, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
     if window:
         self.print_scroll_position(window)
     self.finish_line(get_theme().COLOR_INFORMATION_BAR)
     self._refresh()
开发者ID:krackou,项目名称:poezio,代码行数:11,代码来源:info_wins.py


示例7: draw_resource_line

 def draw_resource_line(self, y, resource, colored):
     """
     Draw a specific resource line
     """
     color = get_theme().color_show(resource.presence)
     self.addstr(y, 4, get_theme().CHAR_STATUS, to_curses_attr(color))
     if colored:
         self.addstr(y, 6, self.truncate_name(str(resource.jid), 6), to_curses_attr(get_theme().COLOR_SELECTED_ROW))
     else:
         self.addstr(y, 6, self.truncate_name(str(resource.jid), 6))
     self.finish_line()
开发者ID:fmeynadier,项目名称:poezio,代码行数:11,代码来源:roster_win.py


示例8: refresh

 def refresh(self):
     self._win.erase()
     self._win.attron(to_curses_attr(self.color))
     format_string = '←{:^%s}→' % 7
     inp = format_string.format(repr(self.value))
     self.addstr(0, 0, inp)
     if self.last_key == 'KEY_RIGHT':
         self.move(0, 8)
     else:
         self.move(0, 0)
     self._win.attroff(to_curses_attr(self.color))
     self._refresh()
开发者ID:krackou,项目名称:poezio,代码行数:12,代码来源:bookmark_forms.py


示例9: write_resource_information

 def write_resource_information(self, resource):
     """
     Write the informations about the resource
     """
     if not resource:
         presence = "unavailable"
     else:
         presence = resource.presence
     color = get_theme().color_show(presence)
     self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
     self.addstr(get_theme().CHAR_STATUS, to_curses_attr(color))
     self.addstr(']', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
开发者ID:krackou,项目名称:poezio,代码行数:12,代码来源:info_wins.py


示例10: rewrite_text

 def rewrite_text(self):
     self._win.erase()
     if self.color:
         self._win.attron(to_curses_attr(self.color))
     self.addstr('*'*len(self.text[self.view_pos:self.view_pos+self.width-1]))
     if self.color:
         (y, x) = self._win.getyx()
         size = self.width-x
         self.addnstr(' '*size, size, to_curses_attr(self.color))
     self.addstr(0, self.pos, '')
     if self.color:
         self._win.attroff(to_curses_attr(self.color))
     self._refresh()
开发者ID:krackou,项目名称:poezio,代码行数:13,代码来源:bookmark_forms.py


示例11: refresh

 def refresh(self):
     self._win.erase()
     self._win.attron(to_curses_attr(self.color))
     self.addnstr(0, 0, ' '*(8), self.width)
     self.addstr(0, 2, "%s"%self.value)
     self.addstr(0, 8, '→')
     self.addstr(0, 0, '←')
     if self.last_key == 'KEY_RIGHT':
         self.addstr(0, 8, '')
     else:
         self.addstr(0, 0, '')
     self._win.attroff(to_curses_attr(self.color))
     self._refresh()
开发者ID:krackou,项目名称:poezio,代码行数:13,代码来源:data_forms.py


示例12: addstr_colored

 def addstr_colored(self, text, y=None, x=None):
     """
     Write a string on the window, setting the
     attributes as they are in the string.
     For example:
     \x19bhello → hello in bold
     \x191}Bonj\x192}our → 'Bonj' in red and 'our' in green
     next_attr_char is the \x19 delimiter
     attr_char is the char following it, it can be
     one of 'u', 'b', 'c[0-9]'
     """
     if y is not None and x is not None:
         self.move(y, x)
     next_attr_char = text.find(FORMAT_CHAR)
     while next_attr_char != -1 and text:
         if next_attr_char + 1 < len(text):
             attr_char = text[next_attr_char+1].lower()
         else:
             attr_char = str()
         if next_attr_char != 0:
             self.addstr(text[:next_attr_char])
         if attr_char == 'o':
             self._win.attrset(0)
         elif attr_char == 'u':
             self._win.attron(curses.A_UNDERLINE)
         elif attr_char == 'b':
             self._win.attron(curses.A_BOLD)
         if (attr_char in string.digits or attr_char == '-') and attr_char != '':
             color_str = text[next_attr_char+1:text.find('}', next_attr_char)]
             if ',' in color_str:
                 tup, char = read_tuple(color_str)
                 self._win.attron(to_curses_attr(tup))
                 if char:
                     if char == 'o':
                         self._win.attrset(0)
                     elif char == 'u':
                         self._win.attron(curses.A_UNDERLINE)
                     elif char == 'b':
                         self._win.attron(curses.A_BOLD)
                 else:
                     # this will reset previous bold/uderline sequences if any was used
                     self._win.attroff(curses.A_UNDERLINE)
                     self._win.attroff(curses.A_BOLD)
             elif color_str:
                 self._win.attron(to_curses_attr((int(color_str), -1)))
             text = text[next_attr_char+len(color_str)+2:]
         else:
             text = text[next_attr_char+2:]
         next_attr_char = text.find(FORMAT_CHAR)
     self.addstr(text)
开发者ID:fmeynadier,项目名称:poezio,代码行数:50,代码来源:base_wins.py


示例13: refresh

 def refresh(self, topic=None):
     log.debug('Refresh: %s', self.__class__.__name__)
     self._win.erase()
     if topic:
         msg = topic[:self.width-1]
     else:
         msg = self._message[:self.width-1]
     self.addstr(0, 0, msg, to_curses_attr(get_theme().COLOR_TOPIC_BAR))
     (y, x) = self._win.getyx()
     remaining_size = self.width - x
     if remaining_size:
         self.addnstr(' '*remaining_size, remaining_size,
                      to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
     self._refresh()
开发者ID:Perdu,项目名称:poezio,代码行数:14,代码来源:muc.py


示例14: draw_group

 def draw_group(self, y, group, colored):
     """
     Draw a groupname on a line
     """
     if colored:
         self._win.attron(to_curses_attr(get_theme().COLOR_SELECTED_ROW))
     if group.folded:
         self.addstr(y, 0, '[+] ')
     else:
         self.addstr(y, 0, '[-] ')
     contacts = " (%s/%s)" % (group.get_nb_connected_contacts(), len(group))
     self.addstr(y, 4, self.truncate_name(group.name, len(contacts)+4) + contacts)
     if colored:
         self._win.attroff(to_curses_attr(get_theme().COLOR_SELECTED_ROW))
     self.finish_line()
开发者ID:fmeynadier,项目名称:poezio,代码行数:15,代码来源:roster_win.py


示例15: write_revisions

 def write_revisions(self, msg):
     if msg.revisions:
         self._win.attron(to_curses_attr(get_theme().COLOR_REVISIONS_MESSAGE))
         self.addstr('%d' % msg.revisions)
         self._win.attrset(0)
         return ceil(log10(msg.revisions + 1))
     return 0
开发者ID:fmeynadier,项目名称:poezio,代码行数:7,代码来源:text_win.py


示例16: addstr_colored_lite

 def addstr_colored_lite(self, text, y=None, x=None):
     """
     Just like addstr_colored, with the single-char attributes
     (\x0E to \x19 instead of \x19 + attr). We do not use any }
     char in this version
     """
     chars = format_chars[:]
     chars.append('\n')
     if y is not None and x is not None:
         self.move(y, x)
     format_char = find_first_format_char(text, chars)
     while format_char != -1:
         if text[format_char] == '\n':
             attr_char = '|'
         else:
             attr_char = self.text_attributes[
                     format_chars.index(text[format_char])]
         self.addstr(text[:format_char])
         self.addstr(attr_char, curses.A_REVERSE)
         text = text[format_char+1:]
         if attr_char == 'o':
             self._win.attrset(0)
         elif attr_char == 'u':
             self._win.attron(curses.A_UNDERLINE)
         elif attr_char == 'b':
             self._win.attron(curses.A_BOLD)
         elif attr_char in string.digits and attr_char != '':
             self._win.attron(to_curses_attr((int(attr_char), -1)))
         format_char = find_first_format_char(text, chars)
     self.addstr(text)
开发者ID:fmeynadier,项目名称:poezio,代码行数:30,代码来源:inputs.py


示例17: write_pre_msg

    def write_pre_msg(self, msg, with_timestamps, nick_size):
        offset = 0
        if with_timestamps:
            offset += self.write_time(msg.str_time)

        if not msg.nickname: # not a message, nothing to do afterwards
            return offset

        nick = truncate_nick(msg.nickname, nick_size)
        offset += poopt.wcswidth(nick)
        if msg.nick_color:
            color = msg.nick_color
        elif msg.user:
            color = msg.user.color
        else:
            color = None
        if msg.ack:
            if msg.ack > 0:
                offset += self.write_ack()
            else:
                offset += self.write_nack()
        if msg.me:
            self._win.attron(to_curses_attr(get_theme().COLOR_ME_MESSAGE))
            self.addstr('* ')
            self.write_nickname(nick, color, msg.highlight)
            offset += self.write_revisions(msg)
            self.addstr(' ')
            offset += 3
        else:
            self.write_nickname(nick, color, msg.highlight)
            offset += self.write_revisions(msg)
            self.addstr('> ')
            offset += 2
        return offset
开发者ID:fmeynadier,项目名称:poezio,代码行数:34,代码来源:text_win.py


示例18: write_additional_informations

 def write_additional_informations(self, informations, jid):
     """
     Write all informations added by plugins by getting the
     value returned by the callbacks.
     """
     for key in informations:
         self.addstr(informations[key](jid), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
开发者ID:krackou,项目名称:poezio,代码行数:7,代码来源:info_wins.py


示例19: write_own_nick

 def write_own_nick(self, room):
     """
     Write our own nick in the info bar
     """
     nick = room.own_nick
     if not nick:
         return
     self.addstr(truncate_nick(nick, 13), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
开发者ID:krackou,项目名称:poezio,代码行数:8,代码来源:info_wins.py


示例20: refresh

 def refresh(self, txt=None):
     log.debug('Refresh: %s', self.__class__.__name__)
     if txt:
         self.txt = txt
     self._win.erase()
     self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_WARNING_PROMPT))
     self.finish_line(get_theme().COLOR_WARNING_PROMPT)
     self._refresh()
开发者ID:fmeynadier,项目名称:poezio,代码行数:8,代码来源:input_placeholders.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python logger.info函数代码示例发布时间:2022-05-27
下一篇:
Python theming.get_theme函数代码示例发布时间: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