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)
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>')
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>')
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/>')
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)
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)
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
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)
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
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
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>'))
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)
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>'))
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)
def set_message(self, message): '''Updates the message''' message = Utils.escape(message) message = Utils.parse_emotes(unicode(message)) self._message_lbl.setText(message)
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)