sidebar: Create an AddUpdateBox

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-04 16:46:34 -04:00
parent 7be89be250
commit 34350d5700
2 changed files with 40 additions and 0 deletions

View File

@ -108,3 +108,26 @@ class TestAddPlaylistButton(unittest.TestCase):
self.assertIsInstance(add.get_popover(), widgets.AddPlaylistPopover)
self.assertEqual(add.get_icon_name(), "list-add")
self.assertEqual(add.get_direction(), Gtk.ArrowType.UP)
class TestAddUpdateBox(unittest.TestCase):
def test_init(self):
box = widgets.AddUpdateBox()
self.assertIsInstance(box, Gtk.Box)
self.assertTrue(box.has_css_class("large-icons"))
self.assertTrue(box.has_css_class("linked"))
self.assertTrue(box.get_homogeneous())
self.assertEqual(box.get_margin_top(), 5)
self.assertEqual(box.get_margin_bottom(), 5)
self.assertEqual(box.get_margin_start(), 5)
self.assertEqual(box.get_margin_end(), 5)
def test_children(self):
box = widgets.AddUpdateBox()
child = box.get_first_child()
self.assertIsInstance(child, widgets.AddPlaylistButton)
child = child.get_next_sibling()
self.assertIsInstance(child, scanner.widgets.AddFolderButton)
child = child.get_next_sibling()
self.assertIsInstance(child, scanner.widgets.UpdateAllButton)

View File

@ -70,3 +70,20 @@ class AddPlaylistButton(Gtk.MenuButton):
self.set_icon_name("list-add")
self.set_direction(Gtk.ArrowType.UP)
self.set_popover(AddPlaylistPopover())
class AddUpdateBox(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(self)
self.add_css_class("large-icons")
self.add_css_class("linked")
self.set_homogeneous(True)
self.set_margin_top(5)
self.set_margin_bottom(5)
self.set_margin_start(5)
self.set_margin_end(5)
self.append(AddPlaylistButton())
self.append(scanner.AddFolderButton())
self.append(scanner.UpdateAllButton())