本文整理汇总了Python中extension.set_default_by_id函数的典型用法代码示例。如果您正苦于以下问题:Python set_default_by_id函数的具体用法?Python set_default_by_id怎么用?Python set_default_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_default_by_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_default_extensions_from_config
def set_default_extensions_from_config(self):
'''get the ids of the default extensions stored on config
and set them as default on the extensions module'''
if self.config.d_extensions is not None:
for cat_name, ext_id in self.config.d_extensions.iteritems():
extension.set_default_by_id(cat_name, ext_id)
示例2: _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')
示例3: _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)
示例4: _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)
示例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: _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)
示例7: extension_register
def extension_register(self):
if sys.platform == "linux2" or sys.platform == 'linux3': #import unix players
extension.register(CATEGORY, handler_mpris.Amarok2Handler)
extension.register(CATEGORY, handler_mpris.AudaciousHandler)
extension.register(CATEGORY, handler_banshee.BansheeHandler)
extension.register(CATEGORY, handler_mpris.ClementineHandler)
extension.register(CATEGORY, handler_exaile.ExaileHandler)
extension.register(CATEGORY, handler_mpris2.GMusicBrowserHandler)
extension.register(CATEGORY, handler_mpris.GuayadequeHandler)
extension.register(CATEGORY, handler_lastfm.LastfmHandler)
extension.register(CATEGORY, handler_moc.MocHandler)
extension.register(CATEGORY, handler_mpd.MpdHandler)
extension.register(CATEGORY, handler_mpris2.PraghaHandler)
extension.register(CATEGORY, handler_mpris2.RhythmboxHandler)
extension.register(CATEGORY, handler_mpris2.AudaciousHandler)
extension.register(CATEGORY, handler_rhythmbox.RhythmboxHandler)
if XMMSCLIENT:
extension.register(CATEGORY, handler_xmms2.Xmms2Handler)
handler_id = self.session.config.d_extensions.get(CATEGORY, None)
if handler_id is None:
handler_id = extension._get_class_name(handler_rhythmbox.RhythmboxHandler)
self.session.config.d_extensions.get(CATEGORY, handler_id)
elif sys.platform == "darwin": #OS X players
extension.register(CATEGORY, handler_itunes.iTunesHandler)
extension.register(CATEGORY, handler_spotify.SpotifyHandler)
handler_id = self.session.config.d_extensions.get(CATEGORY, None)
if handler_id is None:
handler_id = extension._get_class_name(handler_rhythmbox.RhythmboxHandler)
self.session.config.d_extensions.get(CATEGORY, handler_id)
else: #import Windows players
extension.register(CATEGORY, handler_atunes.aTunesHandler)
extension.register(CATEGORY, handler_foobar2000.Foobar2000Handler)
extension.register(CATEGORY, handler_gomplayer.GOMPlayerHandler)
extension.register(CATEGORY, handler_mediamonkey.MediaMonkeyHandler)
extension.register(CATEGORY, handler_mediaplayerclassic.MediaPlayerClassicHandler)
extension.register(CATEGORY, handler_onebyone.OneByOneHandler)
extension.register(CATEGORY, handler_realplayer.RealPlayerHandler)
extension.register(CATEGORY, handler_smplayer.SMPlayerHandler)
extension.register(CATEGORY, handler_winamp.WinampHandler)
extension.register(CATEGORY, handler_xmplay.XMPlayHandler)
handler_id = self.session.config.d_extensions.get(CATEGORY, None)
if handler_id is None:
handler_id = extension._get_class_name(handler_winamp.WinampHandler)
self.session.config.d_extensions.get(CATEGORY, handler_id)
extension.set_default_by_id(CATEGORY, handler_id)
if hasattr(extension, 'unregister'):
extension.register('userpanel button', MusicButton.MusicButton, force_default=True)
else:
extension.register('userpanel button', MusicButton.MusicButton)
示例8: on_preferences_changed
def on_preferences_changed(self, use_http, proxy, session_id, service):
'''called when the preferences on login change'''
self.config.session = session_id
extension.set_default_by_id('session', session_id)
self.config.b_use_http = use_http
self.config.service = service
self._save_proxy_settings(proxy)
示例9: on_preferences_changed
def on_preferences_changed(self, use_http, use_ipv6, proxy, session_id, service):
"""called when the preferences on login change"""
self.config.session = session_id
extension.set_default_by_id("session", session_id)
self.config.b_use_http = use_http
self.config.b_use_ipv6 = use_ipv6
self.config.service = service
self._save_proxy_settings(proxy)
示例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)
示例11: _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)
示例12: _setup
def _setup(self):
'''register core extensions'''
extension.category_register('session', dummy.Session,
single_instance=True)
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 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)
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)
示例13: extensions_register
def extensions_register(self):
import handler_amarok2
import handler_audacious2
import handler_banshee
import handler_exaile
import handler_gmusicbrowser
import handler_guayadeque
import handler_lastfm
import handler_moc
import handler_mpd
import handler_mpris
import handler_rhythmbox
try:
import handler_xmms2
XMMSCLIENT = True
except ImportError:
XMMSCLIENT = False
extension.register(CATEGORY, handler_amarok2.Amarok2Handler)
extension.register(CATEGORY, handler_audacious2.Audacious2Handler)
extension.register(CATEGORY, handler_banshee.BansheeHandler)
extension.register(CATEGORY, handler_exaile.ExaileHandler)
extension.register(CATEGORY, handler_gmusicbrowser.GMusicBrowserHandler)
extension.register(CATEGORY, handler_guayadeque.GuayadequeHandler)
extension.register(CATEGORY, handler_lastfm.LastfmHandler)
extension.register(CATEGORY, handler_moc.MocHandler)
extension.register(CATEGORY, handler_mpd.MpdHandler)
extension.register(CATEGORY, handler_mpris.MprisHandler)
extension.register(CATEGORY, handler_rhythmbox.RhythmboxHandler)
if XMMSCLIENT:
extension.register(CATEGORY, handler_xmms2.Xmms2Handler)
handler_id = self.session.config.d_extensions.get(CATEGORY, None)
if handler_id is None:
handler_id = extension._get_class_name(handler_rhythmbox.RhythmboxHandler)
self.session.config.d_extensions.get(CATEGORY, handler_id)
extension.set_default_by_id(CATEGORY, handler_id)
示例14: _on_extension_changed
def _on_extension_changed(self, combo):
"""callback called when the extension on the combo changes"""
category = str(self.categories_cmb.currentText())
extension_index = self.extensions_cmb.currentIndex()
# when the model is cleared this event is emited
if extension_index == -1:
return
ext, identifier = self.extension_list[extension_index]
if not extension.set_default_by_id(category, identifier):
# TODO: revert the selection to the previous selected extension
log.warning(("Could not set %s as default extension for %s") % (extension_id, category))
return
ext = extension.get_default(category)
self._set_extension_info(ext)
示例15: _on_extension_changed
def _on_extension_changed(self, combo):
"""callback called when the extension on the combo changes
"""
category = self.categories.get_active_text()
extension_index = self.extensions.get_active()
# when the model is cleared this event is emited
if extension_index == -1:
return
ext, identifier = self.extension_list[extension_index]
if not extension.set_default_by_id(category, identifier):
# TODO: revert the selection to the previous selected extension
dbg('Could not set %s as default extension for %s' % (extension_id,
category), 'gtk-preferences')
return
ext = extension.get_default(category)
self._set_extension_info(ext)