当前位置: 首页>>代码示例>>Python>>正文


Python Utils.escape方法代码示例

本文整理汇总了Python中gui.qt4ui.Utils.escape方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.escape方法的具体用法?Python Utils.escape怎么用?Python Utils.escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.qt4ui.Utils的用法示例。


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

示例1: _set_contact_info

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
    def _set_contact_info(self, contact_item, contact):
        '''Fills the contact Item with data'''
        display_name = Utils.escape(unicode(contact.display_name))
        message = Utils.escape(unicode(contact.message))
        sort_role = self.sort_role_dict[contact.status] + display_name

        contact_item.setData(display_name, Role.DisplayRole)
        contact_item.setData(message, Role.MessageRole)
        contact_item.setData(contact.picture, Role.DecorationRole)
        contact_item.setData(contact.media, Role.MediaRole)
        contact_item.setData(contact.status, Role.StatusRole)
        contact_item.setData(contact.blocked, Role.BlockedRole)
        contact_item.setData(contact.account, Role.ToolTipRole)
        contact_item.setData(sort_role, Role.SortRole)
        contact_item.setData(contact, Role.DataRole)
开发者ID:RealDoll,项目名称:emesene,代码行数:17,代码来源:ContactListModel.py

示例2: send_message

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def send_message(self, formatter, my_account,
                  text, cedict, cedir, first):
     '''This method is called from the core, when a message is sent by us.
     It shows the message'''
     self._append_to_chat('<b>ME:</b>')
     self._append_to_chat(Utils.parse_emotes(Utils.escape(unicode(text))))
     self._append_to_chat('<br/>')
开发者ID:EchoUSB,项目名称:emesene,代码行数:9,代码来源:ChatOutput.py

示例3: _set_contact_info

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
    def _set_contact_info(self, contact_item, contact):
        """Fills the contact Item with data"""
        # TODO: handle moving contact between groups
        # in particular: online/offiline
        display_name = Utils.escape(unicode(contact.display_name))
        message = Utils.escape(unicode(contact.message))
        sort_role = self.sort_role_dict[contact.status] + display_name

        contact_item.setData(display_name, Role.DisplayRole)
        contact_item.setData(message, Role.MessageRole)
        contact_item.setData(contact.picture, Role.DecorationRole)
        contact_item.setData(contact.media, Role.MediaRole)
        contact_item.setData(contact.status, Role.StatusRole)
        contact_item.setData(contact.blocked, Role.BlockedRole)
        contact_item.setData(contact.account, Role.ToolTipRole)
        contact_item.setData(sort_role, Role.SortRole)
        contact_item.setData(contact, Role.DataRole)
开发者ID:Roger,项目名称:emesene,代码行数:19,代码来源:ContactListModel.py

示例4: add_group

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def add_group(self, group):
     """Add a group."""
     if not self._config.b_order_by_group:
         return
     new_group_item = QtGui.QStandardItem(Utils.escape(unicode(group.name)))
     new_group_item.setData(group.identifier, Role.UidRole)
     new_group_item.setData(0, Role.TotalCountRole)
     new_group_item.setData(0, Role.OnlCountRole)
     new_group_item.setData(group, Role.DataRole)
     self.appendRow(new_group_item)
开发者ID:Roger,项目名称:emesene,代码行数:12,代码来源:ContactListModel.py

示例5: _format_contact_display_role

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
def _format_contact_display_role(text):
    """Formats correctly a string part of a display role. Parses emotes, and
    scales them."""
    # TODO: calculate smiley size from text's size.
    smiley_size = 16
    text = Utils.escape(text)
    text = replace_markup(text)
    text = Utils.parse_emotes(unicode(text))
    text = text.replace("<img src", '<img width="%d" height="%d" src' % (smiley_size, smiley_size))
    return text
开发者ID:EchoUSB,项目名称:emesene,代码行数:12,代码来源:ContactListDelegate.py

示例6: add_group

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
    def add_group(self, group, force=False):
        '''Add a group.'''
        if not (force or self._order_by_group):
            return

        new_group_item = QtGui.QStandardItem(
                    Utils.escape(unicode(group.name)))
        new_group_item.setData(group.identifier, Role.UidRole)
        new_group_item.setData(group, Role.DataRole)
        self.appendRow(new_group_item)
        return new_group_item
开发者ID:RealDoll,项目名称:emesene,代码行数:13,代码来源:ContactListModel.py

示例7: _show_record

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def _show_record(self, record):
     '''Appends a record in the view'''
     time_string = time.localtime(float(record.created))
     time_string = time.strftime("%H:%M:%S", time_string)
     html = u'<small>(%s): [<b>%s</b>] : '
     html = html % (time_string, record.name)
     try:
         html = html + '%s</small><br />' % Utils.escape(record.msg.strip())
     except AttributeError as detail:
         html = html + '<small><i>&lt;&lt;message insertion failed [%s:%s]&gt;&gt;</i></small><br>' % (type(record.msg), str(record.msg))
     self._cursor.insertHtml(html)
开发者ID:AmiZya,项目名称:emesene,代码行数:13,代码来源:DebugWindow.py

示例8: set_text

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def set_text(self, text):
     '''Displays the given text'''
     #NOTE: do we have to set also the QLineEdit's text?
     #<-> method could be called while the QLEdit is active?
     self._text = unicode(text)
     text = Utils.escape(unicode(text))
     parsed_text = Utils.parse_emotes(text)
     text = QtCore.QString(text)
     if not text.isEmpty():
         self._is_empty_message_displayed = False
         self.label.setText(parsed_text)
     elif self._allow_empty:
         self._is_empty_message_displayed = True
         self.label.setText(self._empty_message)
开发者ID:AmiZya,项目名称:emesene,代码行数:16,代码来源:NickEdit.py

示例9: receive_message

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def receive_message(self, formatter, contact, 
                     message, cedict, cedir, first):
     '''This method is called from the core (e3 or base class or whatever
     when a new message arrives. It shows the new message'''
     log.debug('%s, %s, %s, %s, %s, %s' % (formatter,contact, 
                                           message.type, message.account, 
                                           cedict, first) )
     
     self._append_to_chat(
             Utils.parse_emotes(u'<b>' + contact.display_name + u':</b>'))
     self._append_to_chat(
             Utils.parse_emotes(Utils.escape(unicode(message.body))),
             message.style)
     self._append_to_chat('<br>')
开发者ID:19MiRkO91,项目名称:emesene,代码行数:16,代码来源:ChatOutput.py

示例10: _build_display_role

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def _build_display_role(self, index, is_group=False):
     """Build a string to be used as item's display role"""
     model = index.model()
     data_role = model.data(index, Role.DataRole).toPyObject()
     if is_group:
         name = model.data(index, Role.DisplayRole).toPyObject()
         name = Utils.escape(name)
         online = model.data(index, Role.OnlCountRole).toPyObject()
         total = model.data(index, Role.TotalCountRole).toPyObject()
         display_role = self._config.group_template
         display_role = replace_markup(display_role)
         display_role = display_role.replace("[$NAME]", name)
         display_role = display_role.replace("[$ONLINE_COUNT]", str(online))
         display_role = display_role.replace("[$TOTAL_COUNT]", str(total))
     else:
         # TODO: consider changing how data is stored inside the model,
         # if useful
         display_role = self._format_nick(
             data_role,
             (
                 str(model.data(index, Role.DisplayRole).toPyObject()),
                 data_role.nick,
                 str(model.data(index, Role.MessageRole).toPyObject()),
             ),
         )
         display_role = _format_contact_display_role(display_role)
     #        message = model.data(index, Role.MessageRole).toString()
     #        if not message.isEmpty():
     #            display_role += u'<p style="-qt-paragraph-type:empty; ' \
     #                            u'margin-top:5px; margin-bottom:0px; '  \
     #                            u'margin-left:0px; margin-right:0px; '  \
     #                            u'-qt-block-indent:0; text-indent:0px;"></p>'
     #            message = u'<i>' + message + u'</i>'
     #            display_role += _format_contact_display_role(message)
     # display_role = _format_contact_display_role(display_role)
     # display_role += '</table>'
     return display_role
开发者ID:EchoUSB,项目名称:emesene,代码行数:39,代码来源:ContactListDelegate.py

示例11: set_message

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def set_message(self, message):
     '''Updates the message'''
     message = Utils.escape(message)
     message = Utils.parse_emotes(unicode(message))
     message = message + (u'<br /><span style="font-size: small;">[%s]</span>' % self._account)
     self._message_lbl.setText(message)
开发者ID:EdLirium,项目名称:emesene,代码行数:8,代码来源:UserInfoPanel.py

示例12: information

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def information(self, formatter, contact, message):
     '''This method is called by the core, when there's the need to display 
     an information message'''
     self._append_to_chat(Utils.parse_emotes('<p align="right"><i>' + 
                          Utils.escape(unicode(message)) + 
                          '</i></p>'))
开发者ID:EchoUSB,项目名称:emesene,代码行数:8,代码来源:ChatOutput.py

示例13: set_message

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def set_message(self, message):
     '''Updates the message'''
     message = Utils.escape(message)
     message = Utils.parse_emotes(unicode(message))
     self._message_lbl.setText(message)
开发者ID:Lagg3r,项目名称:emesene,代码行数:7,代码来源:UserInfoPanel.py

示例14: set_nick

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def set_nick(self, nick):
     '''Updates the nick'''
     nick = Utils.escape(nick)
     nick = Utils.parse_emotes(unicode(nick))
     nick = nick + (u'&nbsp;&nbsp;&nbsp;&nbsp;[%s]' % self._account)
     self._display_name_lbl.setText(nick)
开发者ID:Lagg3r,项目名称:emesene,代码行数:8,代码来源:UserInfoPanel.py

示例15: _set_information

# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import escape [as 别名]
 def _set_information(self, lines):
     message, account = lines
     message = Utils.escape(message)
     message = Utils.parse_emotes(unicode(message))
     message = u'%s<br /><span style="font-size: small;">%s</span>' % (message, account)
     self._message_lbl.setText(message)
开发者ID:AmiZya,项目名称:emesene,代码行数:8,代码来源:UserInfoPanel.py


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