当前位置: 首页>>代码示例>>Python>>正文


Python extension.get_and_instantiate函数代码示例

本文整理汇总了Python中extension.get_and_instantiate函数的典型用法代码示例。如果您正苦于以下问题:Python get_and_instantiate函数的具体用法?Python get_and_instantiate怎么用?Python get_and_instantiate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_and_instantiate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, session, radio=False, use_tabs=False):
        '''constructor'''
        ExtensionListTab.__init__(self, session, radio, use_tabs)
        self.updated_amount = 0

        self.config_dir = e3.common.ConfigDir('emesene2')

        self.list_types = ['plugins', 'themes']

        self.collections = \
        {
            'plugins':
            {
                'supported': extension.get_and_instantiate(
                                'supported plugins collection',
                                self.config_dir.join('plugins')),
                'community': extension.get_and_instantiate(
                                'community plugins collection',
                                self.config_dir.join('plugins'))
            },
            'themes':
            {
                'supported': extension.get_and_instantiate(
                                'supported themes collection',
                                self.config_dir.join('themes')),
                'community': extension.get_and_instantiate(
                                'community themes collection',
                                self.config_dir.join('themes'))
            }
        }
开发者ID:arscek,项目名称:emesene,代码行数:30,代码来源:ExtensionList.py

示例2: on_login_succeed

    def on_login_succeed(self):
        '''callback called on login succeed'''
        self._save_login_dimensions()
        self.config.save(self.config_path)
        plugin_manager = get_pluginmanager()
        plugin_manager.scan_directory('plugins')
        plugin_dir = self.config_dir.join('plugins')
        if not os.path.exists(plugin_dir):
            os.makedirs(plugin_dir)
        plugin_manager.scan_directory(plugin_dir)

        self.draw_main_screen()

        self.session.config.get_or_set('l_active_plugins', [])

        for plugin in self.session.config.l_active_plugins:
            plugin_manager.plugin_start(plugin, self.session)
            # hack: where do we start this? how do we generalize for other
            # extensions?
            if plugin == "music":
                extension.get_and_instantiate('listening to',
                        self.window.content)

        self.set_default_extensions_from_config()
        self._sync_emesene1()
        self.logged_in = True

        if self.network_checker is not None:
            self.network_checker.set_new_session(self.session)
开发者ID:Lagg3r,项目名称:emesene,代码行数:29,代码来源:emesene.py

示例3: _new_session

    def _new_session(self, account=None):
        '''create a new session object'''

        if self.session:
            self.close_session(False)

        self.session = extension.get_and_instantiate('session')

        self.session.cb_gui_send_message = extension.get_and_instantiate('send message callback handler')
        self.session.cb_gui_recv_message = extension.get_and_instantiate('receive message callback handler')

        # if you add a signal here, add it on _remove_subscriptions
        signals = self.session.signals
        signals.close.subscribe(self.on_close)
        signals.login_succeed.subscribe(self.on_login_succeed)
        signals.login_failed.subscribe(self.on_login_failed)
        signals.contact_list_ready.subscribe(self.on_contact_list_ready)
        signals.conv_first_action.subscribe(self.on_new_conversation)
        signals.disconnected.subscribe(self.on_disconnected)
        signals.picture_change_succeed.subscribe(self.on_picture_change_succeed)

        #let's start dbus and unity launcher
        self.dbus_ext.set_new_session(self.session, self.window)
        if self.unity_launcher is not None:
            self.unity_launcher.set_session(self.session)
开发者ID:Smile4ever,项目名称:emesene,代码行数:25,代码来源:emesene.py

示例4: _parse_commandline

    def _parse_commandline(self):
        '''parse command line options'''
        options = optionprovider.PluggableOptionParser.get_parsing()[0]

        debugger.init(debuglevel=options.debuglevel)

        if options.version:
            print "Current Emesene Version: " + Info.EMESENE_VERSION
            print "Last Stable Version: " + Info.EMESENE_LAST_STABLE
            print "\n" + Info.EMESENE_WEBSITE
            sys.exit(0)

        #needed to check for autologin
        self.emesene_is_running = False
        try:
            if os.name == 'posix':
                from SingleInstance import SingleInstancePosix as SingleInstance
            else:
                from SingleInstance import SingleInstanceWin32 as SingleInstance

            self.single_instance = SingleInstance()
            if self.single_instance.emesene_is_running():
                self.emesene_is_running = True
                # try to show the instance that's already running
                if options.single_instance:
                    print "Another instance of emesene is already running."
                    self.single_instance.show()
                    extension.get_and_instantiate('quit')
        except ImportError:
            pass

        if options.minimized:
            self.minimize = True
开发者ID:project-hephaestus,项目名称:emesene,代码行数:33,代码来源:emesene.py

示例5: _setup

    def _setup(self):
        """register core extensions"""
        extension.category_register("session", dummy.Session, single_instance=True)
        if xmpp is not None:
            extension.register("session", xmpp.Session)
        extension.register("session", dummy.Session)

        if webqq is not None:
            extension.register("session", webqq.Session)
        extension.register("session", dummy.Session)

        if papylib is not None:
            extension.register("session", papylib.Session)
            extension.set_default("session", papylib.Session)
        else:
            extension.set_default("session", dummy.Session)

        # external API stuff
        self.dbus_ext = extension.get_and_instantiate("external api")
        self.network_checker = extension.get_and_instantiate("network checker")

        self.unity_launcher = extension.get_and_instantiate("unity launcher")

        extension.category_register("sound", e3.common.Sounds.SoundPlayer, None, True)
        extension.category_register("notification", e3.common.notification.Notification)
        extension.category_register("history exporter", e3.Logger.save_logs_as_txt)
        extension.register("history exporter", e3.Logger.save_logs_as_xml)

        if self.config.session is None:
            default_id = extension.get_category("session").default_id
            self.config.session = default_id
        else:
            default_id = self.config.session

        extension.set_default_by_id("session", default_id)
开发者ID:tiancj,项目名称:emesene,代码行数:35,代码来源:emesene.py

示例6: __init__

    def __init__(self, session, on_new_conversation, on_close, on_disconnect_cb):
        """class constructor"""
        gtk.VBox.__init__(self)
        self.session = session

        UserPanel = extension.get_default("user panel")
        ContactList = extension.get_default("contact list")

        self.below_menu = extension.get_and_instantiate("below menu", self)
        self.below_panel = extension.get_and_instantiate("below panel", self)
        self.below_userlist = extension.get_and_instantiate("below userlist", self)

        self.contact_list = ContactList(session)
        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.set_border_width(1)
        self.on_new_conversation = on_new_conversation
        self.on_close = on_close
        self.on_disconnect_cb = on_disconnect_cb

        self.session.signals.contact_attr_changed.subscribe(self._on_contact_attr_changed)

        self.menu = None
        self.contact_menu = None
        self.contact_menu = None
        self.group_menu = None

        self._build_menus()

        self.panel = UserPanel(session)
        self.panel.nick.connect("text-changed", self._on_nick_changed)
        self.panel.message.connect("text-changed", self._on_message_changed)
        self.panel.search.connect("toggled", self._on_search_toggled)
        self.panel.enabled = False

        self.entry = gtk.Entry()
        self.entry.connect("changed", self._on_entry_changed)
        self.entry.connect("key-press-event", self._on_entry_key_press)

        self.pack_start(self.menu, False)
        self.pack_start(self.below_menu, False)
        self.pack_start(self.panel, False)
        self.pack_start(self.below_panel, False)
        self.pack_start(scroll, True, True)
        self.pack_start(self.below_userlist, False)
        self.pack_start(self.entry, False)

        self.contact_list.contact_selected.subscribe(self._on_contact_selected)
        self.contact_list.group_selected.subscribe(self._on_group_selected)
        self.contact_list.contact_menu_selected.subscribe(self._on_contact_menu_selected)
        self.contact_list.group_menu_selected.subscribe(self._on_group_menu_selected)

        scroll.add(self.contact_list)
        scroll.show_all()

        if self.session.config.b_show_userpanel:
            self.panel.hide()

        self.session.config.subscribe(self._on_show_userpanel_changed, "b_show_userpanel")
开发者ID:Otacon,项目名称:emesene,代码行数:60,代码来源:MainWindow.py

示例7: on_preferences_selected

 def on_preferences_selected(self):
     """called when the preference button is selected"""
     instance = extension.get_and_instantiate("preferences", self.session)
     if self.session is not instance.session:
         extension.delete_instance("preferences")
         instance = extension.get_and_instantiate("preferences", self.session)
     instance.show()
     instance.present()
开发者ID:abranches,项目名称:emesene,代码行数:8,代码来源:Handler.py

示例8: on_preferences_selected

 def on_preferences_selected(self):
     '''called when the preference button is selected'''
     instance = extension.get_and_instantiate('preferences', self.session)
     if self.session is not instance.session:
         extension.delete_instance('preferences')
         instance = extension.get_and_instantiate('preferences', self.session)
     instance.show()
     instance.present()
开发者ID:patrickja2007,项目名称:emesene,代码行数:8,代码来源:Handler.py

示例9: __init__

    def __init__(self, session):
        """constructor"""
        self.session = session
        self.instance = extension.get_and_instantiate('preferences', self.session)

        if self.session is not self.instance.session:
            extension.delete_instance('preferences')
            self.instance = extension.get_and_instantiate('preferences', self.session)

        self.page = DownloadExtension(self.session)
开发者ID:Roger,项目名称:emesene-supported-plugins,代码行数:10,代码来源:ExtensionsDownloader.py

示例10: _setup

    def _setup(self):
        '''register core extensions'''
        extension.category_register('session', dummy.Session,
                single_instance=True)
        #extension.category_register('session', msn.Session,
        #        single_instance=True)
        if jabber is not None:
            extension.register('session', jabber.Session)
        extension.register('session', dummy.Session)
        #extension.register('session', msn.Session)

        if papylib is not None:
            extension.register('session', papylib.Session)
            extension.set_default('session', papylib.Session)
        else:
            extension.set_default('session', dummy.Session)

        #DBus extension stuffs
        if DBusController is not None:
            extension.category_register('external api', DBusController)
            extension.set_default('external api', DBusController)
            self.dbus_ext = extension.get_and_instantiate('external api')
        else:
            self.dbus_ext = None

        if DBusNetworkChecker is not None:
            extension.category_register('network checker', DBusNetworkChecker)
            extension.set_default('network checker', DBusNetworkChecker)
            self.network_checker = extension.get_and_instantiate(
                    'network checker')
        else:
            self.network_checker = None

        if UnityLauncher is not None:
            extension.category_register('unity launcher', UnityLauncher)
            extension.set_default('unity launcher', UnityLauncher)
            self.unity_launcher = extension.get_and_instantiate(
                    'unity launcher', self.close_session)
        else:
            self.unity_launcher = None

        extension.category_register('sound', e3.common.Sounds.SoundPlayer,
                None, True)
        extension.category_register('notification',
                e3.common.notification.Notification)
        extension.category_register('history exporter',
                e3.Logger.save_logs_as_txt)

        if self.config.session is None:
            default_id = extension.get_category('session').default_id
            self.config.session = default_id
        else:
            default_id = self.config.session

        extension.set_default_by_id('session', default_id)
开发者ID:Lagg3r,项目名称:emesene,代码行数:55,代码来源:emesene.py

示例11: start

    def start(self, session):
        '''start the plugin'''
        self.session = session
        self.running = True

        self.category_register()
        self.extensions_register()

        extension.get_and_instantiate(CATEGORY, session)

        return True
开发者ID:pekonauta,项目名称:emesene-supported-plugins,代码行数:11,代码来源:plugin.py

示例12: on_preferences_selected

    def on_preferences_selected(self):
        """called when the preference button is selected"""
        self.preferences = extension.get_and_instantiate("preferences", self.session)

        if self.session is not self.preferences.session:
            self.preferences.remove_subscriptions()
            extension.delete_instance("preferences")
            self.preferences = extension.get_and_instantiate("preferences", self.session)

        self.preferences.show()
        self.preferences.present()
开发者ID:bubuntux,项目名称:emesene,代码行数:11,代码来源:Handler.py

示例13: _setup

    def _setup(self):
        '''register core extensions'''
        #extension.category_register('session', dummy.Session,
        #        single_instance=True)
        #if Info.EMESENE_VERSION.endswith("dev"):
        #    extension.register('session', dummy.Session)

        #if webqq is not None:
        #    extension.register('session', webqq.Session)
        #    extension.set_default('session', webqq.Session)

        #if xmpp is not None:
        #    extension.register('session', xmpp.Session)
        #    extension.set_default('session', xmpp.Session)
            
        if whatsapp is not None:
            extension.register('session', whatsapp.Session)
            extension.set_default('session', whatsapp.Session)

        #if papylib is not None:
        #    extension.register('session', papylib.Session)
        #    extension.set_default('session', papylib.Session)

        #external API stuff
        self.dbus_ext = extension.get_and_instantiate('external api')
        self.network_checker = extension.get_and_instantiate(
            'network checker')

        self.unity_launcher = extension.get_and_instantiate('unity launcher')

        extension.category_register('sound', e3.common.Sounds.SoundPlayer,
                None, True)
        extension.category_register('notification',
                e3.common.notification.Notification)
        extension.category_register('history exporter', e3.Logger.ExporterTxt)
        extension.register('history exporter', e3.Logger.ExporterXml)
        extension.register('history exporter', e3.Logger.ExporterHtml)
        extension.register('history exporter', e3.Logger.ExporterCsv)
        extension.register('history exporter', e3.Logger.ExporterJSON)

        # ui callbacks for plugins
        extension.category_register('send message callback handler',
            e3.common.PriorityList, single_instance=True)
        extension.category_register('receive message callback handler',
            e3.common.PriorityList, single_instance=True)

        if self.config.session is None:
            default_id = extension.get_category('session').default_id
            self.config.session = default_id
        else:
            default_id = self.config.session

        extension.set_default_by_id('session', default_id)
开发者ID:ahlfors,项目名称:uazapp-im,代码行数:53,代码来源:emesene.py

示例14: close_session

    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)
开发者ID:project-hephaestus,项目名称:emesene,代码行数:50,代码来源:emesene.py

示例15: start

    def start(self, session):
        """start the plugin"""
        self.session = session

        extension.category_register(CATEGORY, songretriever.BaseMusicHandler, songretriever.BaseMusicHandler, True)
        self.extensions_register()

        extension.get_and_instantiate(CATEGORY, session)

        if hasattr(extension, "unregister"):
            extension.register("userpanel button", MusicButton.MusicButton, force_default=True)
        else:
            extension.register("userpanel button", MusicButton.MusicButton)

        return True
开发者ID:hit,项目名称:emesene-supported-plugins,代码行数:15,代码来源:plugin.py


注:本文中的extension.get_and_instantiate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。