本文整理汇总了Python中quodlibet.qltk.songlist.SongList.set_sort_by方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.set_sort_by方法的具体用法?Python SongList.set_sort_by怎么用?Python SongList.set_sort_by使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.set_sort_by方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_sort_by [as 别名]
class TSongList(TestCase):
HEADERS = ["acolumn", "~#lastplayed", "~foo~bar", "~#rating",
"~#length", "~dirname", "~#track"]
def setUp(self):
quodlibet.config.init()
self.songlist = SongList(SongLibrary())
def test_set_all_column_headers(self):
SongList.set_all_column_headers(self.HEADERS)
headers = [col.header_name for col in self.songlist.get_columns()]
self.failUnlessEqual(headers, self.HEADERS)
def test_set_column_headers(self):
self.songlist.set_column_headers(self.HEADERS)
headers = [col.header_name for col in self.songlist.get_columns()]
self.failUnlessEqual(headers, self.HEADERS)
def test_drop(self):
self.songlist.enable_drop()
self.songlist.disable_drop()
def test_sort_by(self):
self.songlist.set_column_headers(["one", "two", "three"])
for key, order in [("one", True),
("two", False),
("three", False)]:
self.songlist.set_sort_by(None, tag=key, order=order)
self.failUnlessEqual(self.songlist.get_sort_by(), (key, order))
self.songlist.set_sort_by(self.songlist.get_columns()[-1], tag="three")
self.failUnlessEqual(self.songlist.get_sort_by(), ("three", True))
def tearDown(self):
self.songlist.destroy()
quodlibet.config.quit()