本文整理汇总了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