scanner: Set initial ProgressBar visibility based on queue length
ProgressBars might be created after tasks have been pushed onto the queue. Instead of setting initial visibility to False unconditionally, we can check if queue length is greater than 1 Fixes: Issue #9 (Fix ProgressBar initial visibility) Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
53c61160bc
commit
3afaea664b
|
@ -29,6 +29,7 @@ class TestScannerProgressBar(unittest.TestCase):
|
|||
|
||||
for i in range(3): q.push(FakeTask())
|
||||
self.assertTrue(pb.get_visible())
|
||||
self.assertTrue(widgets.ProgressBar(q).get_visible())
|
||||
|
||||
for i in [ 1, 2, 0 ]:
|
||||
q.run()
|
||||
|
|
|
@ -16,7 +16,7 @@ class ProgressBar(Gtk.ProgressBar):
|
|||
|
||||
self.set_valign(Gtk.Align.CENTER)
|
||||
self.set_hexpand(True)
|
||||
self.set_visible(False)
|
||||
self.set_visible(len(queue.tasks) > 0)
|
||||
|
||||
def on_task_pushed(self, queue, task):
|
||||
self.set_visible(True)
|
||||
|
|
Loading…
Reference in New Issue