sidebar: Create an AddPlaylistButton

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-04 16:39:56 -04:00
parent 5b5d166db3
commit 7be89be250
2 changed files with 17 additions and 0 deletions

View File

@ -99,3 +99,12 @@ class TestAddPlaylistPopover(unittest.TestCase):
self.assertIsInstance(child, view.UserView)
child = child.get_next_sibling()
self.assertIsInstance(child, widgets.AddPlaylistEntry)
class TestAddPlaylistButton(unittest.TestCase):
def test_init(self):
add = widgets.AddPlaylistButton()
self.assertIsInstance(add, Gtk.MenuButton)
self.assertIsInstance(add.get_popover(), widgets.AddPlaylistPopover)
self.assertEqual(add.get_icon_name(), "list-add")
self.assertEqual(add.get_direction(), Gtk.ArrowType.UP)

View File

@ -62,3 +62,11 @@ class AddPlaylistPopover(Gtk.Popover):
self.box.append(AddPlaylistEntry())
self.box.set_focus_child(self.box.get_last_child())
self.set_child(self.box)
class AddPlaylistButton(Gtk.MenuButton):
def __init__(self):
Gtk.MenuButton.__init__(self)
self.set_icon_name("list-add")
self.set_direction(Gtk.ArrowType.UP)
self.set_popover(AddPlaylistPopover())