本文整理汇总了Python中quodlibet.qltk.songlist.SongList.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.destroy方法的具体用法?Python SongList.destroy怎么用?Python SongList.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import destroy [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()
示例2: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import destroy [as 别名]
#.........这里部分代码省略.........
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)
self.songlist.set_column_headers(["foo"])
self.assertFalse(self.songlist.Menu("foo", browser, library))
sel = self.songlist.get_selection()
sel.select_all()
self.assertTrue(self.songlist.Menu("foo", browser, library))
def test_get_columns_migrates(self):
self.failIf(config.get("settings", "headers", None))
self.failIf(config.get("settings", "columns", None))
headers = "~album ~#replaygain_track_gain foobar"
config.set("settings", "headers", headers)
columns = get_columns()
self.failUnlessEqual(columns, ["~album", "~#replaygain_track_gain",
"foobar"])
self.failIf(config.get("settings", "headers", None))
def test_get_set_columns(self):
self.failIf(config.get("settings", "headers", None))
self.failIf(config.get("settings", "columns", None))
columns = ["first", "won't", "two words", "4"]
set_columns(columns)
self.failUnlessEqual(columns, get_columns())
columns += ["~~another~one"]
set_columns(columns)
self.failUnlessEqual(columns, get_columns())
self.failIf(config.get("settings", "headers", None))
def test_header_tag_split(self):
self.assertEqual(header_tag_split("foo"), ["foo"])
self.assertEqual(header_tag_split("~foo~bar"), ["foo", "bar"])
self.assertEqual(header_tag_split("<foo>"), ["foo"])
self.assertEqual(header_tag_split("<~foo~bar>"), ["foo", "bar"])
self.assertEqual(header_tag_split("pattern <~foo~bar>"),
["foo", "bar"])
def test_get_sort_tag(self):
self.assertEqual(get_sort_tag("~#track"), "")
self.assertEqual(get_sort_tag("artist"), "artistsort")
self.assertEqual(get_sort_tag("date"), "date")
self.assertEqual(get_sort_tag("~artist~date"), "~artistsort~date")
self.assertEqual(get_sort_tag("~date~artist"), "~date~artistsort")
self.assertEqual(get_sort_tag("composer"), "composersort")
def tearDown(self):
self.songlist.destroy()
config.quit()