本文整理匯總了Python中openlp.core.lib.Settings.sort方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.sort方法的具體用法?Python Settings.sort怎麽用?Python Settings.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類openlp.core.lib.Settings
的用法示例。
在下文中一共展示了Settings.sort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_list
# 需要導入模塊: from openlp.core.lib import Settings [as 別名]
# 或者: from openlp.core.lib.Settings import sort [as 別名]
def get_list(self, type=MediaType.Audio):
media = Settings().value(self.settings_section + '/media files')
media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1]))
extension = []
if type == MediaType.Audio:
extension = self.media_controller.audio_extensions_list
else:
extension = self.media_controller.video_extensions_list
extension = [x[1:] for x in extension]
media = [x for x in media if os.path.splitext(x)[1] in extension]
return media
示例2: getList
# 需要導入模塊: from openlp.core.lib import Settings [as 別名]
# 或者: from openlp.core.lib.Settings import sort [as 別名]
def getList(self, type=MediaType.Audio):
media = Settings().value(self.settingsSection + u'/media files')
media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
ext = []
if type == MediaType.Audio:
ext = self.media_controller.audio_extensions_list
else:
ext = self.media_controller.video_extensions_list
ext = map(lambda x: x[1:], ext)
media = filter(lambda x: os.path.splitext(x)[1] in ext, media)
return media