本文整理汇总了Python中e3.common.RingBuffer.RingBuffer.peak方法的典型用法代码示例。如果您正苦于以下问题:Python RingBuffer.peak方法的具体用法?Python RingBuffer.peak怎么用?Python RingBuffer.peak使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e3.common.RingBuffer.RingBuffer
的用法示例。
在下文中一共展示了RingBuffer.peak方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Conversation
# 需要导入模块: from e3.common.RingBuffer import RingBuffer [as 别名]
# 或者: from e3.common.RingBuffer.RingBuffer import peak [as 别名]
#.........这里部分代码省略.........
def _set_image_visible(self, value):
'''hide or show the widget according to value'''
self.set_image_visible(value)
self._image_visible = value
def _get_image_visible(self):
'''return the value of image_visible'''
return self._image_visible
image_visible = property(fget=_get_image_visible,
fset=_set_image_visible)
def _set_header_visible(self, value):
'''hide or show the widget according to value'''
self.set_header_visible(value)
self._header_visible = value
def _get_header_visible(self):
'''return the value of _header_visible'''
return self._header_visible
header_visible = property(fget=_get_header_visible,
fset=_set_header_visible)
def _set_toolbar_visible(self, value):
'''hide or show the widget according to value'''
self.set_toolbar_visible(value)
self._toolbar_visible = value
def _get_toolbar_visible(self):
'''return the value of image_visible'''
return self._toolbar_visible
toolbar_visible = property(fget=_get_toolbar_visible,
fset=_set_toolbar_visible)
def play_nudge(self):
"""
play the nudge sound
"""
if self.session.config.b_play_nudge:
self.soundPlayer.play(gui.theme.sound_theme.sound_nudge)
def play_send(self):
"""
play the send sound
"""
if self.session.config.b_play_send:
self.soundPlayer.play(gui.theme.sound_theme.sound_send)
def play_type(self):
"""
play the receive sound
"""
if self.session.config.b_play_type and (self.message_waiting or not \
self.session.config.b_mute_sounds_when_focussed):
self.soundPlayer.play(gui.theme.sound_theme.sound_type)
def cycle_history(self, change=-1):
"""
return one of the last N messages sent, the one returned
is the one pointed by message_offset, every time you call
this function it will go to the previous one, you can
reset it using reset_message_offset.
change is the direction of cycling, 1 will go forward
-1 will go backwards
if no message in the buffer return an empty string
if there is message before cycling, it will be stored
till the message sent
"""
if change < 0 and self.message_offset == 0:
self.message_input = self.input.text
self.message_offset += change
if abs(self.message_offset) + 1 > len(self.messages):
self.message_offset=1 - len(self.messages)
if self.message_offset > 0:
self.reset_message_offset()
try:
if self.message_offset == 0:
self.input.text = self.message_input
else:
self.input.text = self.messages.peak(self.message_offset)
except IndexError:
pass
def reset_message_offset(self):
self.message_offset = 0
def _member_to_contact(self,member):
return self.session.contacts.safe_get(member)
def steal_emoticon(self, uri):
"""
receives the path or the uri for the emoticon to be added
"""
raise NotImplementedError("Method not implemented")
示例2: Conversation
# 需要导入模块: from e3.common.RingBuffer import RingBuffer [as 别名]
# 或者: from e3.common.RingBuffer.RingBuffer import peak [as 别名]
#.........这里部分代码省略.........
def _update_single_information(self, account):
'''set the data of the conversation to the data of the account'''
contact = self.session.contacts.get(account)
if contact:
message = MarkupParser.escape(contact.message)
nick = MarkupParser.escape(contact.display_name)
else:
message = ''
nick = account
self.update_single_information(nick, message, account)
def _set_image_visible(self, value):
'''hide or show the widget according to value'''
self.set_image_visible(value)
if value:
self.info.show()
else:
self.info.hide()
self._image_visible = value
def _get_image_visible(self):
'''return the value of image_visible'''
return self._image_visible
image_visible = property(fget=_get_image_visible,
fset=_set_image_visible)
def _set_header_visible(self, value):
'''hide or show the widget according to value'''
self.set_header_visible(value)
self._header_visible = value
def _get_header_visible(self):
'''return the value of image_visible'''
return self._header_visible
header_visible = property(fget=_get_header_visible,
fset=_set_header_visible)
def _set_toolbar_visible(self, value):
'''hide or show the widget according to value'''
self.set_toolbar_visible(value)
self._toolbar_visible = value
def _get_toolbar_visible(self):
'''return the value of image_visible'''
return self._toolbar_visible
toolbar_visible = property(fget=_get_toolbar_visible,
fset=_set_toolbar_visible)
def play_nudge(self):
"""
play the nudge sound
"""
if self.session.config.b_play_nudge:
gui.play(self.session, gui.theme.sound_nudge)
def play_send(self):
"""
play the send sound
"""
if self.session.config.b_play_send:
gui.play(self.session, gui.theme.sound_send)
def play_type(self):
"""
play the receive sound
"""
if self.session.config.b_play_type and self.message_waiting:
gui.play(self.session, gui.theme.sound_type)
def cycle_history(self, change=-1):
"""
return one of the last N messages sent, the one returned
is the one pointed by message_offset, every time you call
this function it will go to the previous one, you can
reset it using reset_message_offset.
change is the direction of cycling, 1 will go forward
-1 will go backwards
if no message in the buffer return an empty string
"""
self.message_offset += change
try:
self.input.text = self.messages.peak(self.message_offset)
except IndexError:
pass
def reset_message_offset(self):
self.message_offset = 0
def _member_to_contact(self,member):
return self.session.contacts.contacts[member]