本文整理汇总了Python中gui.qt4ui.Utils.parse_emotes方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.parse_emotes方法的具体用法?Python Utils.parse_emotes怎么用?Python Utils.parse_emotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.qt4ui.Utils
的用法示例。
在下文中一共展示了Utils.parse_emotes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [as 别名]
def update(self, status, display_name, message, account):
'''Updates the infos shown in the panel'''
pixmap = QtGui.QPixmap(gui.theme.status_icons[status])
#display_name = Utils.escape(display_name)
display_name = Utils.parse_emotes(unicode(display_name +
u' ' \
u'[' + account + u']'))
#message = Utils.escape(message)
message = Utils.parse_emotes(unicode(message))
self._emblem_lbl.setPixmap(pixmap)
self._display_name_lbl.setText(display_name)
self._message_lbl.setText(message)
示例2: receive_message
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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>')
示例3: send_message
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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/>')
示例4: _format_contact_display_role
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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
示例5: set_text
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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)
示例6: _format_contact_display_role
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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)
#log.debug(text)
text = replace_markup(text)
# temporary stuff:
text = Plus.msnplus_strip(text)
text = text.replace('[C=c10ud]', '')
text = Utils.parse_emotes(unicode(text))
text = text.replace('<img src', '<img width="%d" height="%d" src' %
(smiley_size, smiley_size))
#log.debug(text)
return text
示例7: set_message
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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)
示例8: information
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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>'))
示例9: set_message
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [as 别名]
def set_message(self, message):
'''Updates the message'''
message = Utils.escape(message)
message = Utils.parse_emotes(unicode(message))
self._message_lbl.setText(message)
示例10: set_nick
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [as 别名]
def set_nick(self, nick):
'''Updates the nick'''
nick = Utils.escape(nick)
nick = Utils.parse_emotes(unicode(nick))
nick = nick + (u' [%s]' % self._account)
self._display_name_lbl.setText(nick)
示例11: _set_information
# 需要导入模块: from gui.qt4ui import Utils [as 别名]
# 或者: from gui.qt4ui.Utils import parse_emotes [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)