playlist: Create a SortOrderPopover

For use by a Gtk.MenuButton to show the SortOrderView

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-08 15:57:31 -05:00
parent d0049e4951
commit 3b15318f7c
2 changed files with 18 additions and 0 deletions

View File

@ -51,3 +51,12 @@ class TestSortOrderView(unittest.TestCase):
sview.set_playlist(collection)
self.assertEqual(sview.get_model().get_model().get_enabled_model().playlist, collection)
class TestSortOrderPopover(unittest.TestCase):
def test_init(self):
pop = view.SortOrderPopover()
self.assertIsInstance(pop, Gtk.Popover)
self.assertIsInstance(pop.get_child(), view.SortOrderView)
pop.set_playlist(db.user.Table.find("Collection"))

View File

@ -46,3 +46,12 @@ class SortOrderView(Gtk.ListView):
def set_playlist(self, plist):
self.get_model().get_model().set_playlist(plist)
class SortOrderPopover(Gtk.Popover):
def __init__(self):
Gtk.Popover.__init__(self)
self.set_child(SortOrderView())
def set_playlist(self, plist):
self.get_child().set_playlist(plist)