sidebar: Create a LibraryPopover
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
0014e5fa55
commit
fdc4bb7275
|
@ -16,3 +16,19 @@ class TestLibraryButtons(unittest.TestCase):
|
|||
self.assertIsInstance(child, scanner.widgets.RemoveButton)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, scanner.widgets.UpdateButton)
|
||||
|
||||
|
||||
class TestLibraryPopover(unittest.TestCase):
|
||||
def test_init(self):
|
||||
library = db.library.Table.find("/a/b/c")
|
||||
popover = widgets.LibraryPopover(library)
|
||||
self.assertIsInstance(popover, Gtk.Popover)
|
||||
|
||||
box = popover.get_child()
|
||||
self.assertIsInstance(box, Gtk.Box)
|
||||
self.assertEqual(box.get_spacing(), 10)
|
||||
|
||||
child = box.get_first_child()
|
||||
self.assertIsInstance(child, widgets.LibraryButtons)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, scanner.widgets.EnableSwitch)
|
||||
|
|
|
@ -9,3 +9,12 @@ class LibraryButtons(Gtk.Box):
|
|||
self.append(scanner.RemoveButton(library))
|
||||
self.append(scanner.UpdateButton(library))
|
||||
self.add_css_class("linked")
|
||||
|
||||
|
||||
class LibraryPopover(Gtk.Popover):
|
||||
def __init__(self, library):
|
||||
Gtk.Popover.__init__(self)
|
||||
box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10)
|
||||
box.append(LibraryButtons(library))
|
||||
box.append(scanner.EnableSwitch(library))
|
||||
self.set_child(box)
|
||||
|
|
Loading…
Reference in New Issue