sidebar: Create a custom ProgressBar

This takes the ProgressBar from the scanner widgets and puts in in a Box
with Labels on either side to reserve its space at all times.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-10-12 15:28:07 -04:00
parent 7beebbc7d1
commit 0152ba1431
2 changed files with 25 additions and 0 deletions

View File

@ -32,3 +32,20 @@ class TestLibraryPopover(unittest.TestCase):
self.assertIsInstance(child, widgets.LibraryButtons)
child = child.get_next_sibling()
self.assertIsInstance(child, scanner.widgets.EnableSwitch)
class TestProgressBar(unittest.TestCase):
def test_init(self):
pbar = widgets.ProgressBar()
self.assertIsInstance(pbar, Gtk.Box)
child = pbar.get_first_child()
self.assertIsInstance(child, Gtk.Label)
self.assertEqual(child.get_text(), " ")
child = child.get_next_sibling()
self.assertIsInstance(child, scanner.widgets.ProgressBar)
child = child.get_next_sibling()
self.assertIsInstance(child, Gtk.Label)
self.assertEqual(child.get_text(), " ")

View File

@ -18,3 +18,11 @@ class LibraryPopover(Gtk.Popover):
box.append(LibraryButtons(library))
box.append(scanner.EnableSwitch(library))
self.set_child(box)
class ProgressBar(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(self)
self.append(Gtk.Label.new(" "))
self.append(scanner.ProgressBar())
self.append(Gtk.Label.new(" "))