本文整理汇总了Python中e3.common.RingBuffer.RingBuffer.push方法的典型用法代码示例。如果您正苦于以下问题:Python RingBuffer.push方法的具体用法?Python RingBuffer.push怎么用?Python RingBuffer.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e3.common.RingBuffer.RingBuffer
的用法示例。
在下文中一共展示了RingBuffer.push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Conversation
# 需要导入模块: from e3.common.RingBuffer import RingBuffer [as 别名]
# 或者: from e3.common.RingBuffer.RingBuffer import push [as 别名]
#.........这里部分代码省略.........
false otherwise'''
return len(self.members) > 1
is_group_chat = property(fget=_get_group_chat)
def _send_typing_notification(self):
'''method called to send typing notifications'''
self.session.send_typing_notification(self.cid)
def output_message(self, message, cedict):
'''display current outgoing message into OutputText'''
msg = self.conv_status.pre_process_message(self.session.contacts.me,
message, False, cedict, self.emcache.path, message.timestamp,
message.type, self.cstyle)
self.output.send_message(self.formatter, msg)
self.conv_status.post_process_message(msg)
def _on_send_message(self, text):
'''method called when the user press enter on the input text'''
cedict = self.emcache.parse()
custom_emoticons = gui.base.MarkupParser.get_custom_emotes(text, cedict)
self.session.send_message(self.cid, text, self.cstyle,
cedict, custom_emoticons)
message = e3.Message(e3.Message.TYPE_MESSAGE, text, None, self.cstyle)
self.output_message(message, cedict)
self.messages.push(text)
self.reset_message_offset()
self.play_send()
self.conv_status.update_status()
def input_message(self, message, contact, cedict, cepath):
'''display current ingoing message into OutputText'''
msg = self.conv_status.pre_process_message(contact,
message, True, cedict, cepath,
message.timestamp, message.type, message.style)
self.output.receive_message(self.formatter, msg)
self.conv_status.post_process_message(msg)
def on_receive_message(self, message, account, received_custom_emoticons):
'''method called when a message arrives to the conversation'''
contact = self.session.contacts.safe_get(account)
if message.type == e3.Message.TYPE_MESSAGE or \
message.type == e3.Message.TYPE_FLNMSG:
if self.session.config.b_override_text_color:
message.style.color = \
e3.base.Color.from_hex(self.session.config.override_text_color)
user_emcache = self.caches.get_emoticon_cache(account)
#XXX: when we send messages from the web iface we get those here, so show them propertly
if contact.account == self.session.contacts.me.account:
self.output_message(message, None)
return
示例2: Conversation
# 需要导入模块: from e3.common.RingBuffer import RingBuffer [as 别名]
# 或者: from e3.common.RingBuffer.RingBuffer import push [as 别名]
#.........这里部分代码省略.........
def on_close(self):
'''called when the conversation is closed'''
raise NotImplementedError("Method not implemented")
def _get_message_waiting(self):
'''return True if a message is waiting'''
return self._message_waiting
def _set_message_waiting(self, value):
'''set the value of message waiting, update the gui to reflect
the value'''
self._message_waiting = value
self.update_message_waiting(value)
message_waiting = property(fget=_get_message_waiting,
fset=_set_message_waiting)
def _get_group_chat(self):
'''return True if the conversation contains more than one member,
false otherwise'''
return len(self.members) > 1
group_chat = property(fget=_get_group_chat)
def _on_send_message(self, text):
'''method called when the user press enter on the input text'''
custom_emoticons = gui.base.MarkupParser.get_custom_emotes(text, self.emcache.parse())
self.session.send_message(self.cid, text, self.cstyle, self.emcache.parse(), custom_emoticons)
message = e3.Message(e3.Message.TYPE_MESSAGE, text, None, self.cstyle)
self.output.send_message(self.formatter, self.session.contacts.me,
message, self.emcache.parse(), self.emcache.path, self.first)
self.messages.push(text)
self.play_send()
self.first = False
def on_receive_message(self, message, account, received_custom_emoticons):
'''method called when a message arrives to the conversation'''
contact = self.session.contacts.get(account)
if contact is None:
contact = e3.Contact(account)
if message.type == e3.Message.TYPE_MESSAGE or message.type == e3.Message.TYPE_FLNMSG:
if self.session.config.b_override_text_color:
message.style.color = e3.base.Color.from_hex(self.session.config.override_text_color)
user_emcache = self.caches.get_emoticon_cache(account)
self.output.receive_message(self.formatter, contact, message,
received_custom_emoticons, user_emcache.path, self.first)
self.play_type()
elif message.type == e3.Message.TYPE_NUDGE:
self.output.information(self.formatter, contact,
_('%s just sent you a nudge!') % (contact.display_name,))
self.play_nudge()
self.first = False
def on_send_message_failed(self, errorCode):
'''method called when a message fails to be delivered'''
contact = self.session.contacts.me
self.output.information(self.formatter, contact, \
_('Error delivering message'))
self.first = False