本文整理汇总了Python中sipsimple.configuration.settings.SIPSimpleSettings.default_account方法的典型用法代码示例。如果您正苦于以下问题:Python SIPSimpleSettings.default_account方法的具体用法?Python SIPSimpleSettings.default_account怎么用?Python SIPSimpleSettings.default_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sipsimple.configuration.settings.SIPSimpleSettings
的用法示例。
在下文中一共展示了SIPSimpleSettings.default_account方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_default_account
# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import default_account [as 别名]
def _set_default_account(self, account):
if account is not None and not account.enabled:
raise ValueError("account %s is not enabled" % account.id)
notification_center = NotificationCenter()
settings = SIPSimpleSettings()
with self._lock:
old_account = self.accounts.get(settings.default_account, None)
if account is old_account:
return
if account is None:
settings.default_account = None
else:
settings.default_account = account.id
settings.save()
# we need to post the notification in the file-io thread in order to have it serialized after the
# SIPAccountManagerDidAddAccount notification that is triggered when the account is saved the first
# time, because save is executed in the file-io thread while this runs in the current thread. -Dan
call_in_thread('file-io', notification_center.post_notification, 'SIPAccountManagerDidChangeDefaultAccount', sender=self, data=NotificationData(old_account=old_account, account=account))