本文整理汇总了Python中extension.get_category函数的典型用法代码示例。如果您正苦于以下问题:Python get_category函数的具体用法?Python get_category怎么用?Python get_category使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_category函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
"""
the main method of emesene
"""
extension.category_register("session", dummy.Session, single_instance=True)
extension.category_register("option provider", None, interfaces=interfaces.IOptionProvider)
extension.get_category("option provider").multi_extension = True
extension.get_category("option provider").activate(ExtensionDefault)
options = PluggableOptionParser(args=emesene_args)
options.read_options()
main_method = extension.get_default("main")
main_method(Controller)
示例2: main
def main():
"""
the main method of emesene
"""
extension.category_register('session', msn.Session, single_instance=True)
extension.category_register('option provider', None,
interfaces=interfaces.IOptionProvider)
extension.get_category('option provider').multi_extension = True
extension.get_category('option provider').activate(ExtensionDefault)
options = PluggableOptionParser(argv)
options.read_options()
main_method = extension.get_default('main')
main_method(Controller)
示例3: main
def main():
"""
the main method of emesene
"""
#extension.category_register('session', dummy.Session, single_instance=True)
extension.category_register('option provider', None,
interfaces=interfaces.IOptionProvider)
extension.register('quit', sys.exit)
extension.get_category('option provider').multi_extension = True
extension.get_category('option provider').activate(optionprovider.ExtensionDefault)
options = optionprovider.PluggableOptionParser(args=emesene_args)
options.read_options()
main_method = extension.get_default('main')
main_method(Controller)
示例4: set_default
def set_default(self, option, opt, value, parser):
"""set default extensions"""
for couple in value.split(";"):
category_name, ext_name = [strng.strip() for strng in couple.split(":", 2)]
if not extension.get_category(category_name).set_default_by_name(ext_name):
print 'Error setting extension "%s" default session to "%s"' % (category_name, ext_name)
示例5: _setup
def _setup(self):
"""register core extensions"""
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", msn.Session)
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)
get_pluginmanager().scan_directory("plugins")
示例6: set_default
def set_default(self, option, opt, value, parser):
for couple in value.split(';'):
(category_name, ext_name) = map(string.strip, couple.split(':', 2))
if not extension.get_category(category_name)\
.set_default_by_name(ext_name):
print 'Error setting extension "%s" default session to "%s"'\
% (category_name, ext_name)
示例7: _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)
示例8: _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
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)
示例9: _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)
示例10: __init__
def __init__(self, args):
self.parser = optparse.OptionParser(conflict_handler="resolve")
self.args = args
custom_options = extension.get_category('option provider').use()()\
.option_register().get_result()
for opt in custom_options.values():
self.parser.add_option(opt)
示例11: _setup
def _setup(self):
'''register core extensions'''
extension.category_register('session', msn.Session,
single_instance=True)
extension.register('session', jabber.Session)
extension.register('session', dummy.Session)
if papylib is not None:
extension.register('session', papylib.Session)
extension.set_default('session', papylib.Session)
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)
get_pluginmanager().scan_directory('plugins')
示例12: config
def config(self, session):
'''config the plugin'''
category = extension.get_category(CATEGORY)
player = category.get_instance()
if player != None:
player.preferences()
self.redraw_main_window()
return True
示例13: set_default
def set_default(self, option, opt, value, parser):
'''set default extensions'''
for couple in value.split(';'):
category_name, ext_name = [strng.strip()\
for strng in couple.split(':', 2)]
if not extension.get_category(category_name)\
.set_default_by_name(ext_name):
print 'Error setting extension "%s" default session to "%s"'\
% (category_name, ext_name)
示例14: import_and_register
def import_and_register(category_name, cls):
try:
imported_cls = __import__('gui.common.'+cls)
if extension.get_category(category_name) is None:
extension.category_register(category_name, eval(cls+'.'+cls))
else:
extension.register(category_name, eval(cls+'.'+cls))
return imported_cls
except ImportError:
return None
示例15: _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)