playlist: Create a PlaylistWindow scrolled window

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-10-30 09:38:47 -04:00
parent 2311a3a697
commit fd728a7a99
2 changed files with 24 additions and 0 deletions

View File

@ -22,3 +22,17 @@ class TestPlaylistView(unittest.TestCase):
self.assertIsNone(pview.get_playlist())
pview.set_playlist(collection)
self.assertEqual(pview.get_playlist(), collection)
class TestPlaylistWindow(unittest.TestCase):
def test_init(self):
collection = db.user.Table.find("Collection")
window = view.PlaylistWindow()
self.assertIsInstance(window, Gtk.ScrolledWindow)
self.assertIsInstance(window.get_child(), view.PlaylistView)
self.assertIsInstance(window.get_filter_model(), Gtk.FilterListModel)
self.assertIsNone(window.get_playlist())
window.set_playlist(collection)
self.assertEqual(window.get_playlist(), collection)

View File

@ -25,3 +25,13 @@ class PlaylistView(Gtk.ColumnView):
def get_filter_model(self): return self.get_model().get_filter_model()
def get_playlist(self): return self.get_model().get_playlist()
def set_playlist(self, plist): self.get_model().set_playlist(plist)
class PlaylistWindow(Gtk.ScrolledWindow):
def __init__(self):
Gtk.ScrolledWindow.__init__(self)
self.set_child(PlaylistView())
def get_filter_model(self): return self.get_child().get_filter_model()
def get_playlist(self): return self.get_child().get_playlist()
def set_playlist(self, plist): self.get_child().set_playlist(plist)