def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() # prevent image chooser from staying open and breaking things image_chooser = extension.get_instance('image chooser') if image_chooser: image_chooser.hide() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.hide_all() self._on_conversation_window_close(conv_manager) if self.timeout_id: glib.source_remove(self.timeout_id) self.timeout_id = None if self.session is not None: self.session.stop_mail_client() self.session.quit() self.window.on_disconnect(self.close_session) self._save_application_language() self.save_extensions_config() self._save_login_dimensions() if self.session is not None and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) if do_exit: if self.tray_icon is not None: self.tray_icon.set_visible(False) self.window.hide() self.window = None sys.exit(0)
def config(self, session): '''config the plugin''' player = extension.get_instance(CATEGORY) if player is not None: player.preferences() return True
def show_update(self, installed_only=False): '''called when the liststore need to be changed''' self.clear_all() self.update_amount = 0 for theme_type in self.themes.iterkeys(): first = True if theme_type not in self.update_list['themes']: self.update_list['themes'][theme_type] = {} for path in self.themes[theme_type].list(): if not self.check_updates('themes', theme_type, path): continue if first: self.append(False, self.theme_names[theme_type], theme_type, visible=False) first = False name = os.path.basename(path) label = self.themes[theme_type].get_name_from_path(path) self.update_list['themes'][theme_type][name] = path self.update_amount += 1 self.append(True, label, name, path=path, type_=theme_type) pluginmanager = get_pluginmanager() first = True if 'plugin' not in self.update_list['plugins']: self.update_list['plugins']['plugin'] = {} for name, plugin in pluginmanager.get_plugins(): path = plugin.path if not self.check_updates('plugins', 'plugin', path, plugin): continue if first: self.append(False, _('Plugins'), 'installed', True, False) first = False self.update_list['plugins']['plugin'][name] = path self.update_amount += 1 self.append(True, name, name, path=path, type_='plugin', description=pluginmanager.plugin_description(name)) if self.update_amount > 0 and self.first: self.first = False extension.get_instance('preferences').show_updates_tab()
def __init__(self, session, arg): """constructor""" gtk.ToggleButton.__init__(self) self.set_tooltip_text(_('Enable/Disable Music Plugin')) music_image = utils.gtk_ico_image_load(gui.theme.emote_theme.emote_to_path('(8)', True), gtk.ICON_SIZE_MENU) self.set_image(music_image) self.set_relief(gtk.RELIEF_NONE) self.connect('toggled', self._on_button_toggled) self.music = extension.get_instance('listening to') self.set_active(self.music.is_running())
def __init__(self, session, arg): """constructor""" gtk.ToggleButton.__init__(self) self.set_tooltip_text(_('Enable/Disable Music Plugin')) music_image = utils.gtk_ico_image_load( gui.theme.emote_theme.emote_to_path('(8)', True), gtk.ICON_SIZE_MENU) self.set_image(music_image) self.set_relief(gtk.RELIEF_NONE) self.connect('toggled', self._on_button_toggled) self.music = extension.get_instance('listening to') self.set_active(self.music.is_running())
def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() # close all dialogs that are open extension.get_default('dialog').close_all() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.close_all() if self.session: self.session.stop_mail_client() self.session.quit() if self.session is not None: self._save_application_language() self.session.save_extensions_config() self._save_login_dimensions() if self.session and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) #http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks #http://mg.pov.lt/objgraph/ # install python-objgraph # also you can run emesene in pdb: pdb ./emesene.py # then 'r' and CTRL+C when you need the shell. #import objgraph ##objgraph.show_most_common_types() #objgraph.show_growth() if do_exit: extension.get_and_instantiate('quit') if os.name == "nt": os._exit(0)
def __init__(self, userpanel, arg): """constructor""" gtk.ToggleButton.__init__(self) self.session = userpanel.session music_image = utils.gtk_ico_image_load(gui.theme.emote_theme.emote_to_path('(8)', True), gtk.ICON_SIZE_MENU) self.set_image(music_image) self.set_relief(gtk.RELIEF_NONE) self.connect('toggled', self._on_button_toggled) self.music = extension.get_instance('listening to') enabled = self.session.config.get_or_set('music_enabled', False) self.set_active(enabled) if hasattr(extension, "subscribe"): extension.subscribe(self._on_extension_changed, 'listening to')
def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() # close all dialogs that are open extension.get_default('dialog').close_all() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.close_all() if self.session: self.session.stop_mail_client() self.session.quit() self._save_application_language() self.session.save_extensions_config() self._save_login_dimensions() if self.session and self.logged_in: self.session.save_config() self.logged_in = False self.session = None self.config.save(self.config_path) #http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks #http://mg.pov.lt/objgraph/ # install python-objgraph # also you can run emesene in pdb: pdb ./emesene.py # then 'r' and CTRL+C when you need the shell. #import objgraph ##objgraph.show_most_common_types() #objgraph.show_growth(limit=None) if do_exit: extension.get_and_instantiate('quit') if os.name == "nt": os._exit(0)
def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() # close all dialogs that are open extension.get_default('dialog').close_all() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.close_all() if self.session: self.session.stop_mail_client() self.session.quit() self.window.on_disconnect(self.close_session) if self.session is not None: self._save_application_language() self.session.save_extensions_config() self._save_login_dimensions() if self.session and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) if do_exit: if self.tray_icon is not None: self.tray_icon.set_visible(False) extension.get_and_instantiate('quit') if os.name == "nt": os._exit(0)
def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.hide_all() self._on_conversation_window_close(conv_manager) if self.timeout_id: glib.source_remove(self.timeout_id) self.timeout_id = None if self.session is not None: self.session.stop_mail_client() self.session.quit() self.window.on_disconnect(self.close_session) self.save_extensions_config() self._save_login_dimensions() if self.session is not None and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) if do_exit: if self.tray_icon is not None: self.tray_icon.set_visible(False) self.window.hide() self.window = None sys.exit(0)
def close_session(self, do_exit=True, server_disconnected=False): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() # close all dialogs that are open extension.get_default('dialog').close_all() self._remove_subscriptions() if server_disconnected: for conv_manager in self.conversations: conv_manager.close_session() self.conv_manager_available = True # update with new session else: for conv_manager in self.conversations: conv_manager.close_all() if self.session: self.session.stop_mail_client() self.session.quit() self.window.on_disconnect(self.close_session) self._save_application_language() if self.session is not None: self.session.save_extensions_config() self._save_login_dimensions() if self.session and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) if do_exit: if self.tray_icon is not None: self.tray_icon.set_visible(False) extension.get_and_instantiate('quit')
def close_session(self, do_exit=True): '''close session''' # prevent preference window from staying open and breaking things pref = extension.get_instance('preferences') if pref: pref.hide() self._remove_subscriptions() for conv_manager in self.conversations: conv_manager.hide_all() self._on_conversation_window_close(conv_manager) if self.timeout_id: glib.source_remove(self.timeout_id) self.timeout_id = None if self.session is not None: self.session.quit() self.window.on_disconnect(self.close_session) self.save_extensions_config() self._save_login_dimensions() if self.session is not None and self.logged_in: self.session.save_config() self.session = None self.logged_in = False self.config.save(self.config_path) if do_exit: if self.tray_icon is not None: self.tray_icon.set_visible(False) self.window.hide() self.window = None sys.exit(0)
def stop(self): send_cb_handler = extension.get_instance('send message callback handler') # Remove the callback from the PriorityList so we cleanup resources send_cb_handler.remove(MessageProcessor.capitalize) return False
def start(self, session): send_cb_handler = extension.get_instance('send message callback handler') # Append our callback to the PriorityList which is processed # when an e3.base.Message.Message is fired from the UI send_cb_handler.append(MessageProcessor.capitalize, prio=-99) return True