本文整理汇总了Python中quodlibet.qltk.songlist.SongList.add_songs方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.add_songs方法的具体用法?Python SongList.add_songs怎么用?Python SongList.add_songs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.add_songs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import add_songs [as 别名]
#.........这里部分代码省略.........
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)
self.songlist.set_songs([], scroll=False)
def test_set_songs_restore_select(self):
song = AudioFile({"~filename": "/dev/null"})
self.songlist.add_songs([song])
sel = self.songlist.get_selection()
sel.select_path(Gtk.TreePath.new_first())
self.songlist.set_songs([song], scroll_select=True)
self.assertEqual(self.songlist.get_selected_songs(), [song])
song2 = AudioFile({"~filename": "/dev/null"})
self.songlist.set_songs([song2], scroll_select=True)
self.assertEqual(self.songlist.get_selected_songs(), [])
def test_set_songs_no_restore_select(self):
song = AudioFile({"~filename": "/dev/null"})
self.songlist.add_songs([song])
model = self.songlist.get_model()
model.go_to(song)
self.assertIs(model.current, song)
# only restore if there was a selected one
self.songlist.set_songs([song], scroll_select=True)
self.assertEqual(self.songlist.get_selected_songs(), [])
def test_get_selected_songs(self):
song = AudioFile({"~filename": "/dev/null"})
self.songlist.add_songs([song])
sel = self.songlist.get_selection()
sel.select_path(Gtk.TreePath.new_first())
self.assertEqual(self.songlist.get_selected_songs(), [song])
self.assertEqual(self.songlist.get_first_selected_song(), song)
sel.unselect_all()
self.assertEqual(self.songlist.get_selected_songs(), [])
self.assertIs(self.songlist.get_first_selected_song(), None)