Browse Source

closes #722 - progress bar still visible when disabled

pull/746/head
Chris 3 years ago
parent
commit
a66f56edd6
2 changed files with 24 additions and 1 deletions
  1. 3
      gooey/gui/containers/application.py
  2. 22
      gooey/tests/test_application.py

3
gooey/gui/containers/application.py

@ -262,7 +262,8 @@ class GooeyApplication(wx.Frame):
self.header.setTitle(_("running_title"))
self.header.setSubtitle(_('running_msg'))
self.footer.showButtons('stop_button')
self.footer.progress_bar.Show(True)
if not self.buildSpec.get('disable_progress_bar_animation', False):
self.footer.progress_bar.Show(True)
self.footer.time_remaining_text.Show(False)
if self.buildSpec.get('timing_options')['show_time_remaining']:
self.timer.start()

22
gooey/tests/test_application.py

@ -92,6 +92,28 @@ class TestGooeyApplication(unittest.TestCase):
self.assertEqual(terminal.GetFont().GetWeight(), weight)
def testProgressBarHiddenWhenDisabled(self):
options = [
{'disable_progress_bar_animation': True},
{'disable_progress_bar_animation': False},
{}
]
for kwargs in options:
parser = self.basicParser()
with instrumentGooey(parser, **kwargs) as (app, gapp):
mockClientRunner = MagicMock()
gapp.clientRunner = mockClientRunner
# transition's Gooey to the running state using the now mocked processor.
# so that we can make assertions about the visibility of footer buttons
gapp.onStart()
# the progress bar flag is awkwardly inverted (is_disabled, rather than
# is_enabled). Thus inverting the expectation here. When disabled is true,
# shown should be False,
expect_shown = not kwargs.get('disable_progress_bar_animation', False)
self.assertEqual(gapp.footer.progress_bar.IsShown(), expect_shown)
def basicParser(self):
parser = ArgumentParser()
parser.add_argument('--foo')

Loading…
Cancel
Save