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