本文整理汇总了Python中openlp.core.lib.Settings.contains方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.contains方法的具体用法?Python Settings.contains怎么用?Python Settings.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.lib.Settings
的用法示例。
在下文中一共展示了Settings.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: app_startup
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import contains [as 别名]
def app_startup(self):
"""
Do a couple of things when the app starts up. In this particular case
we want to check if we have the old "Use Phonon" setting, and convert
it to "enable Phonon" and "make it the first one in the list".
"""
Plugin.app_startup(self)
settings = Settings()
settings.beginGroup(self.settingsSection)
if settings.contains(u'use phonon'):
log.info(u'Found old Phonon setting')
players = self.media_controller.mediaPlayers.keys()
has_phonon = u'phonon' in players
if settings.value(u'use phonon') and has_phonon:
log.debug(u'Converting old setting to new setting')
new_players = []
if players:
new_players = [player for player in players if player != u'phonon']
new_players.insert(0, u'phonon')
self.media_controller.mediaPlayers[u'phonon'].isActive = True
settings.setValue(u'players', u','.join(new_players))
self.settingsTab.load()
settings.remove(u'use phonon')
settings.endGroup()