• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python extension.get_and_instantiate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _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)
        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
        extension.category_register('external api', DBusController)
        extension.set_default('external api', DBusController)
        self.dbus_ext = extension.get_and_instantiate('external api')
        
        extension.category_register('sound', e3.common.play_sound.play)
        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:cando,项目名称:emesene,代码行数:33,代码来源:emesene.py


示例17: __init__

    def __init__(self, session, cid, update_window, members=None):
        """constructor"""
        self.update_window = update_window
        self.session = session
        self.caches = e3.cache.CacheManager(self.session.config_dir.base_dir)
        self.emcache = self.caches.get_emoticon_cache(self.session.account.account)

        self.cid = float(cid)
        self.icid = self.cid
        self.formatter = e3.common.MessageFormatter(session.contacts.me)
        self.first = True

        self._header_visible = True
        self._image_visible = True
        self._toolbar_visible = True

        self._message_waiting = True

        buffer_size = session.config.get_or_set("i_msg_history_size", 5)
        self.messages = RingBuffer(max=buffer_size)
        self.message_offset = 0

        if members is None:
            self.members = []
        else:
            self.members = members

        self._style = None

        # the base class should override this attributes
        self.info = None
        self.input = None
        self.output = None
        self.soundPlayer = extension.get_and_instantiate("sound", session)
开发者ID:Roger,项目名称:emesene,代码行数:34,代码来源:Conversation.py


示例18: __init__

    def __init__(self, session):
        """
        Class Constructor
        """
        self.session = session
        self.session.config.get_or_set('b_notify_contact_online', True)
        self.session.config.get_or_set('b_notify_contact_offline', True)
        self.session.config.get_or_set('b_notify_receive_message', True)
        self.session.config.get_or_set('b_notify_typing', False)
        self.session.config.get_or_set('b_notify_when_focussed', False)
        self.session.config.get_or_set('b_notify_only_when_available', True)

        self.notifier = extension.get_default('notificationGUI')
        self.picture_factory = extension.get_default('notificationImage')
        self.sound_player = extension.get_and_instantiate('sound', session)

        if self.session:
            self.session.signals.conv_message.subscribe(
                self._on_message)
            self.session.signals.user_typing.subscribe(
                self._on_user_typing)
            self.session.signals.contact_attr_changed.subscribe(
                self._on_contact_attr_changed)
            self.session.signals.mail_received.subscribe(
                self._on_mail_received)
            self.session.signals.filetransfer_completed.subscribe(
                self._on_filetransfer_completed)
            self.session.signals.filetransfer_canceled.subscribe(
                self._on_filetransfer_canceled)
            self.session.signals.filetransfer_invitation.subscribe(
                self._on_filetransfer_invitation)

        self.notify_online = False
        self.last_online = None
开发者ID:GunioRobot,项目名称:emesene,代码行数:34,代码来源:notification.py


示例19: on_filetransfer_invitation

    def on_filetransfer_invitation(self, transfer, conv_id):
        """ called when a new file transfer is issued """
        if self._conv_id != conv_id:
            return

        self.transferw = extension.get_and_instantiate("filetransfer widget", self._session, transfer)
        self.transferw.show()
开发者ID:Roger,项目名称:emesene,代码行数:7,代码来源:Conversation.py


示例20: _replace_below_userlist

 def _replace_below_userlist(self):
     self.remove(self.below_userlist)
     self.below_userlist = extension.get_and_instantiate('below userlist', self)
     self.pack_start(self.below_userlist, False)
     pos = len(self.get_children()) - 1
     self.reorder_child(self.below_userlist, pos)
     self.below_userlist.show()
开发者ID:anuragdaware,项目名称:emesene,代码行数:7,代码来源:MainWindow.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python extension.get_categories函数代码示例发布时间:2022-05-24
下一篇:
Python extension.category_register函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap