本文整理汇总了Python中quodlibet.qltk.songlist.SongList.toggle_column_sort方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.toggle_column_sort方法的具体用法?Python SongList.toggle_column_sort怎么用?Python SongList.toggle_column_sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.toggle_column_sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import toggle_column_sort [as 别名]
class TSongList(TestCase):
HEADERS = ["acolumn", "~#lastplayed", "~foo~bar", "~#rating",
"~#length", "~dirname", "~#track"]
def setUp(self):
config.init()
self.songlist = SongList(SongLibrary())
self.orders_changed = 0
def orders_changed_cb(*args):
self.orders_changed += 1
self.songlist.connect("orders-changed", orders_changed_cb)
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_orders([(key, order)])
self.failUnlessEqual(
self.songlist.get_sort_orders(), [(key, order)])
self.songlist.toggle_column_sort(self.songlist.get_columns()[-1])
self.failUnlessEqual(
self.songlist.get_sort_orders(), [("three", True)])
def test_sort_orders(self):
s = self.songlist
s.set_column_headers(["foo", "quux", "bar"])
values = [("foo", True), ("bar", False)]
s.set_sort_orders(values)
self.assertEqual(s.get_sort_orders(), values)
s.toggle_column_sort(s.get_columns()[1], replace=False)
self.assertEqual(s.get_sort_orders(), values + [("quux", False)])
s.toggle_column_sort(s.get_columns()[1], replace=True)
self.assertEqual(s.get_sort_orders(), [("quux", False)])
def test_toggle_sort(self):
s = self.songlist
s.set_column_headers(["foo"])
self.assertEqual(self.orders_changed, 1)
s.toggle_column_sort(s.get_columns()[0], replace=True)
self.assertEqual(self.orders_changed, 2)
self.assertEqual(s.get_sort_orders(), [("foo", False)])
s.toggle_column_sort(s.get_columns()[0], replace=True)
self.assertEqual(self.orders_changed, 3)
self.assertEqual(s.get_sort_orders(), [("foo", True)])
def test_clear_sort(self):
s = self.songlist
s.set_column_headers(["foo"])
s.toggle_column_sort(s.get_columns()[0], replace=True)
self.assertTrue(s.get_sort_orders())
s.clear_sort()
self.assertFalse(s.get_sort_orders())
def test_not_sortable(self):
s = self.songlist
s.sortable = False
s.set_column_headers(["foo"])
s.toggle_column_sort(s.get_columns()[0])
self.assertEqual(self.orders_changed, 0)
self.assertFalse(s.get_sort_orders())
def test_find_default_sort_column(self):
s = self.songlist
self.assertTrue(s.find_default_sort_column() is None)
s.set_column_headers(["~#track"])
self.assertTrue(s.find_default_sort_column())
def test_inline_search_state(self):
self.assertEqual(self.songlist.get_search_column(), 0)
self.assertTrue(self.songlist.get_enable_search())
def test_set_songs(self):
self.songlist.set_songs([], sorted=True)
self.songlist.set_songs([], sorted=False)
self.songlist.set_songs([], scroll_select=True)
self.songlist.set_songs([], scroll_select=False)
self.songlist.set_songs([], scroll=True)
#.........这里部分代码省略.........