def on_new_conversation(self, cid, members, other_started=True): '''callback called when the other user does an action that justify opening a conversation''' if self.conversations is None: windowcls = extension.get_default('window frame') window = windowcls(self._on_conversation_window_close) window.go_conversation(self.session) self._set_location(window, True) self.conversations = window.content self.tray_icon.set_conversations(self.conversations) if self.session.config.b_conv_minimized: window.iconify() window.show() conversation = self.conversations.new_conversation(cid, members) conversation.update_data() conversation.show() # puts widget visible # raises the container and grabs the focus # handles cases where window is minimized and ctrl+tab focus stealing if not other_started: self.conversations.set_current_page(conversation.tab_index) self.conversations.get_parent().present() conversation.input_grab_focus() if not self.session.config.b_mute_sounds and other_started and \ self.session.contacts.me.status != e3.status.BUSY and \ self.session.config.b_play_first_send and not \ self.session.config.b_play_type: gui.play(self.session, gui.theme.sound_send)
def play(**kwargs): import xbmcaddon addon = xbmcaddon.Addon(id='plugin.video.ran_de') height = (234, 270, 396, 480, 540, 720)[int(addon.getSetting('video.quality'))] resource = urllib.unquote_plus(kwargs['resource']) gui.play(api.get_video_url(resource, height))
def play(**kwargs): import gui import xbmcaddon addon = xbmcaddon.Addon(id='plugin.video.atv_at') protocol = ('http', 'rtsp')[int(addon.getSetting('protocol'))] if addon.getSetting('video.as_playlist') == 'true': playlist = api.get_playlist(urllib.unquote(kwargs['url']), protocol) gui.play_playlist(playlist) else: gui.play(api.get_video_url(urllib.unquote(kwargs['url']), protocol))
def on_new_conversation(self, cid, members, other_started=True): """callback called when the other user does an action that justify opening a conversation""" conversation_tabs = self.session.config.get_or_set("b_conversation_tabs", True) conv_manager = None # check to see if there is a conversation with the same member for convman in self.conversations: if convman.reuse_conversation(cid, members): conv_manager = convman break if conv_manager is None: if not self.conversations or not conversation_tabs: windowcls = extension.get_default("window frame") window = windowcls(self._on_conversation_window_close) window.go_conversation(self.session) self._set_location(window, True) conv_manager = window.content self.conversations.append(conv_manager) if self.session.config.b_conv_minimized: window.iconify() window.show() window.iconify() else: window.show() else: conv_manager = self.conversations[0] self.tray_icon.set_conversations(self.conversations) conversation = conv_manager.new_conversation(cid, members) conversation.update_data() conversation.show() # puts widget visible # raises the container and grabs the focus # handles cases where window is minimized and ctrl+tab focus stealing if not other_started: conv_manager.present(conversation) if ( not self.session.config.b_mute_sounds and other_started and self.session.contacts.me.status != e3.status.BUSY and self.session.config.b_play_first_send and not self.session.config.b_play_type ): gui.play(self.session, gui.theme.sound_send)
def on_new_conversation(self, cid, members, other_started=True): '''callback called when the other user does an action that justify opening a conversation''' conversation_tabs = self.session.config.get_or_set( 'b_conversation_tabs', True) conv_manager = None # check to see if there is a conversation with the same member for convman in self.conversations: if convman.reuse_conversation(cid, members): conv_manager = convman break if conv_manager is None: if not self.conversations or not conversation_tabs: windowcls = extension.get_default('window frame') window = windowcls(self._on_conversation_window_close) window.go_conversation(self.session) self._set_location(window, True) conv_manager = window.content self.conversations.append(conv_manager) if self.session.config.b_conv_minimized and other_started: window.iconify() window.show() window.iconify() else: window.show() else: conv_manager = self.conversations[0] self.tray_icon.set_conversations(self.conversations) conversation = conv_manager.new_conversation(cid, members) conversation.update_data() conversation.show() # puts widget visible # raises the container and grabs the focus # handles cases where window is minimized and ctrl+tab focus stealing if not other_started: conv_manager.present(conversation) if not self.session.config.b_mute_sounds and other_started and \ self.session.contacts.me.status != e3.status.BUSY and \ self.session.config.b_play_first_send and not \ self.session.config.b_play_type: gui.play(self.session, gui.theme.sound_send)
def _on_contact_attr_changed(self, account, change_type, old_value, do_notify=True): """callback called when an attribute of a contact changed""" contact = self.session.contacts.get(account) if not contact: log.debug("account %s not found on contacts" % account) if change_type == "online" and do_notify: if self.session.config.b_play_contact_online: gui.play(self.session, gui.theme.sound_online) elif change_type == "offline": if self.session.config.b_play_contact_offline: gui.play(self.session, gui.theme.sound_offline)
def _on_contact_attr_changed(self, account, change_type, old_value, do_notify=True): '''callback called when an attribute of a contact changed''' contact = self.session.contacts.get(account) if not contact: log.debug('account %s not found on contacts' % account) if change_type == 'online' and do_notify: if self.session.config.b_play_contact_online: gui.play(self.session, gui.theme.sound_online) elif change_type == 'offline': if self.session.config.b_play_contact_offline: gui.play(self.session, gui.theme.sound_offline)
def _on_contact_attr_changed(self, account, change_type, old_value, do_notify=True): '''callback called when an attribute of a contact changed''' contact = self.session.contacts.get(account) if not contact: log.debug('account %s not found on contacts' % account) if change_type == 'status' and do_notify: if old_value == e3.base.status.OFFLINE and \ contact.status != e3.base.status.OFFLINE and \ self.session.config.b_play_contact_online: gui.play(self.session, gui.theme.sound_online) elif old_value != e3.base.status.OFFLINE and \ contact.status == e3.base.status.OFFLINE and \ self.session.config.b_play_contact_offline: gui.play(self.session, gui.theme.sound_offline)
def on_new_conversation(self, cid, members, other_started=True): """callback called when the other user does an action that justify opening a conversation""" if self.conversations is None: windowcls = extension.get_default("window frame") window = windowcls(self._on_conversation_window_close) window.go_conversation(self.session) self._set_location(window, True) self.conversations = window.content self.tray_icon.set_conversations(self.conversations) window.show() conversation = self.conversations.new_conversation(cid, members) conversation.update_data() # the following lines (up to and including the second show() ) # do 2 things: # a) make sure proper tab is selected (if multiple tabs are opened) # when clicking on a user icon # b) place cursor on text box # both the show() calls are needed - won't work otherwise # EDIT: it works with the first show() setting the input as the first # focused widget and deniing focus to notebook's tabs conversation.show() # puts widget visible # conversation widget MUST be visible (cf. previous line) self.conversations.set_current_page(conversation.tab_index) # raises the container (tabbed windows) if its minimized self.conversations.get_parent().present() # conversation.show() # puts cursor in textbox # play = extension.get_default('sound') if ( not self.session.config.b_mute_sounds and other_started and self.session.contacts.me.status != e3.status.BUSY and self.session.config.b_play_first_send and not self.session.config.b_play_type ): gui.play(gui.theme.sound_send)
def _on_contact_attr_changed(self, account, change_type, old_value, do_notify=True): """callback called when an attribute of a contact changed""" contact = self.session.contacts.get(account) if not contact: dbg("account " + account + " not found on contacts", "mainwindow", 1) if change_type == "online" and do_notify: if self.session.config.b_notify_contact_online: gui.notify(contact.display_name, "is now online") if self.session.config.b_play_contact_online: gui.play(self.session, gui.theme.sound_online) elif change_type == "offline": if self.session.config.b_notify_contact_offline: gui.notify(contact.display_name, "is now offline") if self.session.config.b_play_contact_offline: gui.play(self.session, gui.theme.sound_offline)
def _on_contact_attr_changed(self, account, change_type, old_value, do_notify=True): '''callback called when an attribute of a contact changed''' contact = self.session.contacts.get(account) if not contact: log.debug('account %s not found on contacts' % account) if change_type == 'online' and do_notify: if self.session.config.b_notify_contact_online: gui.notify(contact.display_name, "is now online") if self.session.config.b_play_contact_online: gui.play(self.session, gui.theme.sound_online) elif change_type == 'offline': if self.session.config.b_notify_contact_offline: gui.notify(contact.display_name, "is now offline") if self.session.config.b_play_contact_offline: gui.play(self.session, gui.theme.sound_offline)
def play_nudge(self): """ play the nudge sound """ gui.play(self.session, gui.theme.sound_nudge)
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 play_send(self): """ play the send sound """ if self.session.config.b_play_send: gui.play(self.session, gui.theme.sound_send)
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_type(self): """ play the send sound """ gui.play(self.session, gui.theme.sound_type)
from gui import play play()