sidebar: Create a LibraryButtons box

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-05 16:29:22 -04:00
parent 59d9c3b484
commit 0014e5fa55
2 changed files with 29 additions and 0 deletions

18
sidebar/test_widgets.py Normal file
View File

@ -0,0 +1,18 @@
# Copyright 2021 (c) Anna Schumaker.
import db
import scanner
import unittest
from gi.repository import Gtk
from . import widgets
class TestLibraryButtons(unittest.TestCase):
def test_init(self):
library = db.library.Table.find("/a/b/c")
buttons = widgets.LibraryButtons(library)
self.assertIsInstance(buttons, Gtk.Box)
self.assertTrue(buttons.has_css_class("linked"))
child = buttons.get_first_child()
self.assertIsInstance(child, scanner.widgets.RemoveButton)
child = child.get_next_sibling()
self.assertIsInstance(child, scanner.widgets.UpdateButton)

11
sidebar/widgets.py Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2021 (c) Anna Schumaker.
import db
import scanner
from gi.repository import Gtk
class LibraryButtons(Gtk.Box):
def __init__(self, library):
Gtk.Box.__init__(self)
self.append(scanner.RemoveButton(library))
self.append(scanner.UpdateButton(library))
self.add_css_class("linked")