本文整理匯總了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()