本文整理汇总了Python中quodlibet.qltk.songlist.SongList.get_model方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.get_model方法的具体用法?Python SongList.get_model怎么用?Python SongList.get_model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.get_model方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import get_model [as 别名]
#.........这里部分代码省略.........
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)
def test_add_songs(self):
song = AudioFile({"~filename": "/dev/null"})
# unsorted
self.songlist.add_songs([song])
self.songlist.add_songs([song])
# sorted
self.songlist.set_column_headers(["foo"])
self.songlist.toggle_column_sort(self.songlist.get_columns()[0])
self.songlist.add_songs([])
self.songlist.add_songs([song])
self.songlist.add_songs([song])