本文整理汇总了Python中quodlibet.qltk.songlist.SongList.enable_drop方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.enable_drop方法的具体用法?Python SongList.enable_drop怎么用?Python SongList.enable_drop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.enable_drop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import enable_drop [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: __init__
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import enable_drop [as 别名]
def __init__(self, Kind, library):
super(LibraryBrowser, self).__init__(dialog=False)
self.set_default_size(600, 400)
self.enable_window_tracking("browser_" + Kind.__name__)
self.set_border_width(6)
self.set_title(Kind.name + " - Quod Libet")
self.add(gtk.VBox(spacing=6))
view = SongList(library, update=True)
self.add_accel_group(view.accelerators)
self.songlist = view
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_IN)
sw.add(view)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
self.browser = browser = Kind(library, False)
if browser.reordered:
view.enable_drop()
elif browser.dropped:
view.enable_drop(False)
if browser.accelerators:
self.add_accel_group(browser.accelerators)
self.__container = browser.pack(sw)
self.child.pack_start(self.__container)
self.__statusbar = gtk.Label()
self.__statusbar.set_text(_("No time information"))
self.__statusbar.set_alignment(1.0, 0.5)
self.__statusbar.set_ellipsize(pango.ELLIPSIZE_START)
self.child.pack_end(self.__statusbar, expand=False)
browser.connect('songs-selected', self.__browser_cb)
browser.finalize(False)
view.connect('popup-menu', self.__menu, library)
view.connect('drag-data-received', self.__drag_data_recv)
view.connect('row-activated', self.__enqueue)
view.get_selection().connect('changed', self.__set_time)
if browser.headers is not None:
view.connect('columns-changed', self.__cols_changed, browser)
self.__cols_changed(view, browser)
sw.show_all()
for c in self.child.get_children():
c.show()
self.child.show()
self.show()
self.__set_pane_size()
示例3: TSongList
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import enable_drop [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)
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import enable_drop [as 别名]
def __init__(self, Kind, library, player):
super(LibraryBrowser, self).__init__(dialog=False)
self._register_instance()
self.name = Kind.__name__
self.set_default_size(600, 400)
self.enable_window_tracking("browser_" + self.name)
self.set_title(Kind.name + " - Quod Libet")
self.add(Gtk.VBox())
view = SongList(library, update=True)
view.info.connect("changed", self.__set_time)
self.songlist = view
sw = ScrolledWindow()
sw.set_shadow_type(Gtk.ShadowType.IN)
sw.add(view)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self.browser = browser = Kind(library)
if browser.can_reorder:
view.enable_drop()
elif browser.dropped:
view.enable_drop(False)
if browser.accelerators:
self.add_accel_group(browser.accelerators)
self.__container = browser.pack(sw)
self.get_child().pack_start(self.__container, True, True, 0)
main = self.get_child()
bottom = Gtk.HBox()
main.pack_end(bottom, False, True, 0)
self._filter_menu = filter_menu = FilterMenu(library, player)
filter_menu.set_browser(self.browser)
self.add_accel_group(filter_menu.get_accel_group())
bottom.pack_start(filter_menu.get_widget(), False, True, 0)
filter_menu.get_widget().show()
self.__statusbar = Gtk.Label()
self.__statusbar.set_text(_("No time information"))
self.__statusbar.set_alignment(1.0, 0.5)
self.__statusbar.set_padding(6, 3)
self.__statusbar.set_ellipsize(Pango.EllipsizeMode.START)
bottom.pack_end(self.__statusbar, True, True, 0)
self.__statusbar.show()
bottom.show()
browser.connect('songs-selected', self.__browser_cb)
browser.finalize(False)
view.connect('popup-menu', self.__menu, library)
view.connect('drag-data-received', self.__drag_data_recv)
view.connect('row-activated', self.__enqueue, player)
if browser.headers is not None:
view.connect('columns-changed', self.__cols_changed, browser)
self.__cols_changed(view, browser)
sw.show_all()
for c in self.get_child().get_children():
c.show()
self.get_child().show()
self.connect("destroy", self._on_destroy)