當前位置: 首頁>>代碼示例>>Python>>正文


Python RingBuffer.push方法代碼示例

本文整理匯總了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
開發者ID:Stiveknx,項目名稱:emesene,代碼行數:70,代碼來源:Conversation.py

示例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
開發者ID:abranches,項目名稱:emesene,代碼行數:70,代碼來源:Conversation.py


注:本文中的e3.common.RingBuffer.RingBuffer.push方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。