本文整理汇总了Python中extension.set_default函数的典型用法代码示例。如果您正苦于以下问题:Python set_default函数的具体用法?Python set_default怎么用?Python set_default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_default函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _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')
示例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)
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")
示例3: _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)
示例4: _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)
示例5: _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)
示例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: _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)
示例8: _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 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)
示例9: setup
def setup():
"""
define all the components for a Qt4 environment
"""
# pylint: disable=W0403
import AvatarChooser
import Conversation
import DebugWindow
import Dialog
import Notifier
import PictureHandler
import Preferences
import TopLevelWindow
import TrayIcon
import menus
import pages
import widgets
extension.category_register('avatar chooser', AvatarChooser.AvatarChooser)
extension.category_register('conversation', Conversation.Conversation)
extension.category_register('dialog', Dialog.Dialog)
extension.category_register('debug window', DebugWindow.DebugWindow)
extension.category_register('notificationGUI', Notifier.Notifier)
extension.category_register('preferences', Preferences.Preferences,
single_instance=True)
extension.category_register('window frame', TopLevelWindow.TopLevelWindow)
extension.category_register('tray icon', TrayIcon.TrayIcon)
#FIXME:
extension.set_default('tray icon', TrayIcon.TrayIcon)
extension.category_register('connecting window', pages.ConnectingPage)
extension.category_register('conversation window', pages.ConversationPage)
extension.category_register('login window', pages.LoginPage)
extension.category_register('main window', pages.MainPage)
extension.category_register('contact list', widgets.ContactList)
extension.category_register('conversation input', widgets.ChatInput)
extension.category_register('conversation toolbar', widgets.ConversationToolbar)
extension.category_register('avatar', widgets.DisplayPic)
extension.category_register('image area selector',
widgets.ImageAreaSelector)
extension.category_register('nick edit', widgets.NickEdit)
extension.category_register('smiley chooser', widgets.SmileyPopupChooser)
extension.category_register('status combo', widgets.StatusCombo)
# TODO: change this extension's name to 'conversation header' ??
extension.category_register('info panel', widgets.UserInfoPanel)
#extension.category_register('filetransfer widget', widgets.FileTransfer)
try:
import PyQt4.QtWebKit
extension.category_register('conversation output',
widgets.AdiumChatOutput)
extension.register('conversation output', widgets.ChatOutput)
except:
extension.category_register('conversation output', widgets.ChatOutput)
extension.category_register('main menu', menus.MainMenu)
extension.category_register('menu file', menus.FileMenu)
extension.category_register('menu actions', menus.ActionsMenu)
extension.category_register('menu options', menus.OptionsMenu)
extension.category_register('menu help', menus.HelpMenu)
extension.category_register('menu contact', menus.ContactMenu)
extension.category_register('menu group', menus.GroupMenu)
extension.category_register('menu profile', menus.ProfileMenu)
extension.category_register('menu status', menus.StatusMenu)
extension.category_register('tray main menu', menus.TrayMainMenu)
extension.category_register('tray login menu', menus.TrayLoginMenu)
extension.category_register('picture handler',
PictureHandler.PictureHandler)
示例10: __destroy_dbus_session
def __destroy_dbus_session(self):
'''Destroy current dbus session'''
if self.__dbus_object:
try:
dbus.service.Object.remove_from_connection(self.__dbus_object)
except AttributeError:
pass
self.__dbus_object = None
#Callback functions
def __on_status_changed(self, status):
self.__dbus_object.status_changed(status)
extension.register('external api', DBusController)
extension.set_default('external api', DBusController)
class EmeseneObject(dbus.service.Object):
"""
The object that is exported via DBUS
"""
def __init__(self, bus_name, object_path, session, window):
try:
dbus.service.Object.__init__(self, bus_name, object_path)
except Exception, ex:
print 'Emesene DBUS error: %s' % str(ex)
self.__session = session
self.__window = window
def get_session(self):
示例11: setup
def setup():
"""
define all the components for a gtk environment
"""
global WEBKITERROR, INFOBARERROR
import gtk
gtk.settings_get_default().set_property("gtk-error-bell", False)
extension.register('quit', gtk.main_quit)
extension.set_default('quit', gtk.main_quit)
extension.category_register('dialog', Dialog.Dialog)
extension.category_register('avatar chooser', AvatarChooser.AvatarChooser)
extension.category_register('avatar', Avatar.Avatar)
extension.category_register('avatar manager', AvatarManager.AvatarManager)
extension.category_register('preferences', Preferences.Preferences,
single_instance=True)
extension.category_register('login window', Login.Login)
extension.category_register('connecting window', Login.ConnectingWindow)
extension.category_register('window frame', Window.Window)
extension.category_register('main window', MainWindow.MainWindow)
extension.category_register('contact list', ContactList.ContactList)
extension.category_register('synch tool', SyncTool.SyncTool)
if not check_gtk3():
extension.category_register('avatar renderer', Renderers.AvatarRenderer)
extension.category_register('nick renderer', Renderers.CellRendererPlus)
extension.register('nick renderer', Renderers.CellRendererNoPlus)
else:
extension.category_register('avatar renderer', RenderersNew.AvatarRenderer)
extension.category_register('nick renderer', RenderersNew.CellRendererPlus)
extension.register('nick renderer', RenderersNew.CellRendererNoPlus)
extension.category_register('user panel', UserPanel.UserPanel)
extension.category_register('debug window', DebugWindow.DebugWindow)
if not INFOBARERROR:
extension.category_register('nice bar', InfoBar.NiceBar)
extension.register('nice bar', NiceBar.NiceBar)
else:
extension.category_register('nice bar', NiceBar.NiceBar)
extension.category_register('main menu', MainMenu.MainMenu)
extension.category_register('menu file', MainMenu.FileMenu)
extension.category_register('menu actions', MainMenu.ActionsMenu)
extension.category_register('menu options', MainMenu.OptionsMenu)
extension.category_register('menu contact', ContactMenu.ContactMenu)
extension.category_register('menu group', GroupMenu.GroupMenu)
extension.category_register('menu account', AccountMenu.AccountMenu)
extension.category_register('menu help', MainMenu.HelpMenu)
extension.category_register('menu status', StatusMenu.StatusMenu)
extension.category_register('below menu', EmptyWidget.EmptyWidget)
extension.category_register('below panel', EmptyWidget.EmptyWidget)
extension.category_register('below userlist', EmptyWidget.EmptyWidget)
extension.category_register('call widget', CallWidget.CallWindow)
extension.category_register('conversation window', \
ConversationManager.ConversationManager)
extension.category_register('conversation', Conversation.Conversation)
extension.category_register('conversation header', Header.Header)
extension.category_register('conversation info',
ContactInfoRotate.ContactInfoRotate)
extension.register('conversation info', ContactInfoList.ContactInfoList)
extension.category_register('conversation tab', TabWidget.TabWidget)
extension.category_register('conversation input', TextBox.InputText)
extension.category_register('conversation toolbar', \
ConversationToolbar.ConversationToolbar)
extension.category_register('plugin window', \
PluginWindow.PluginWindow)
if not check_gtk3():
extension.category_register('image area selector', ImageAreaSelector.ImageAreaSelectorDialog)
else:
extension.category_register('image area selector', ImageAreaSelectorNew.ImageAreaSelectorDialog)
extension.category_register('filetransfer pool', FileTransferBarWidget.FileTransferBarWidget)
extension.category_register('filetransfer widget', FileTransferWidget.FileTransferWidget)
if not WEBKITERROR:
extension.category_register('conversation output', AdiumTextBox.OutputText)
extension.register('conversation output', TextBox.OutputText)
else:
extension.category_register('conversation output', TextBox.OutputText)
extension.category_register('picture handler', PictureHandler.PictureHandler)
示例12: gtk_main
def gtk_main(Controller):
""" main method for gtk frontend
"""
global WEBKITERROR, INFOBARERROR
import gtk
import gobject
import utils
import AccountMenu
import Avatar
import AvatarChooser
import AvatarManager
import CallWidget
import ContactMenu
import ContactList
import SyncTool
import ContactInfoRotate
import ContactInfoList
import Conversation
import ConversationManager
import ConversationToolbar
import DebugWindow
import Dialog
import EmptyWidget
import FileTransferBarWidget
import FileTransferWidget
import GroupMenu
import VerifyCodeWindow
import Header
if not check_gtk3():
import ImageAreaSelector
else:
import ImageAreaSelectorNew as ImageAreaSelector
import Login
import MainMenu
import MainWindow
try:
import InfoBar
except ImportError:
INFOBARERROR = True
import NiceBar
import Preferences
if not check_gtk3():
import Renderers
else:
import RenderersNew as Renderers
import StatusMenu
import TabWidget
import TextBox
import UserPanel
import Window
try:
import AdiumTextBox
except ImportError:
WEBKITERROR = True
import PictureHandler
if check_gtk3():
import TinyButtonNew
else:
import TinyButton
setup()
gobject.threads_init()
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
controller = Controller()
controller.start()
extension.set_default('quit', gtk.main_quit)
gtk.main()
gtk.gdk.threads_leave()
示例13: DummyNetworkChecker
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# emesene is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with emesene; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""Dummy Implementation of a Network Manager."""
import logging
log = logging.getLogger("emesene.e3.common.NetworkManagerHelper")
import extension
class DummyNetworkChecker():
''' this class does lazy checks for network availability and
disconnects emesene if the network goes down '''
#Public methods
def set_new_session(self, session):
pass
def stop(self):
pass
extension.category_register('network checker', DummyNetworkChecker)
extension.set_default('network checker', DummyNetworkChecker)
示例14: GioNetworkChecker
import logging
log = logging.getLogger("emesene.e3.common.NetworkManagerHelper")
import extension
class GioNetworkChecker():
''' this class does lazy checks for network availability and
disconnects emesene if the network goes down '''
def __init__(self):
self.__session = None
self.alert_watcher = None
#Public methods
def set_new_session(self, session):
self.__session = session
if self.alert_watcher is None:
self.alert_watcher = Gio.NetworkMonitor.get_default()
self.alert_watcher.connect("network-changed", self._on_network_changed)
def stop(self):
pass
#Callback functions
def _on_network_changed(self, monitor, avariable):
if not avariable:
# 1 means reconnect
self.__session.add_event(Event.EVENT_DISCONNECTED, 'Network error', 1)
extension.category_register('network checker', GioNetworkChecker)
extension.set_default('network checker', GioNetworkChecker)
示例15: stop
def stop(self):
pass
def connected_cb(self):
self.connected = True
def connected_info_cb(self):
self.connected = True
def disconnected_cb(self):
self.connected = False
# 1 means reconnect
self.__session.add_event(Event.EVENT_DISCONNECTED, 'Network error', 1)
extension.category_register('network checker', Win32NetworkChecker)
extension.set_default('network checker', Win32NetworkChecker)
if __name__ == '__main__':
# Run an expample of the code so that the user can test the code in
# real life.
from threading import Thread
def connected():
print 'Connected'
def connected_info():
print 'Connected'
def disconnected():
print 'Disconnected'
manager = NetworkManager(connected, connected_info, disconnected)