diff --git a/gooey/_tmp/example_progress_bar_2.py b/gooey/_tmp/example_progress_bar_2.py index ae70555..776f8f2 100644 --- a/gooey/_tmp/example_progress_bar_2.py +++ b/gooey/_tmp/example_progress_bar_2.py @@ -10,7 +10,7 @@ from gooey import Gooey, GooeyParser @Gooey(progress_regex=r"^progress: (\d+)/(\d+)$", progress_expr="x[0] / x[1] * 100", - progress_animation=False) + disable_progress_bar_animation=False) def main(): parser = GooeyParser(prog="example_progress_bar_2") parser.add_argument("steps", type=int, default=15) diff --git a/gooey/_tmp/example_progress_bar_4.py b/gooey/_tmp/example_progress_bar_4.py index c322ffa..7cd2792 100644 --- a/gooey/_tmp/example_progress_bar_4.py +++ b/gooey/_tmp/example_progress_bar_4.py @@ -9,7 +9,7 @@ from gooey import Gooey, GooeyParser @Gooey(progress_regex=r"^progress: (-?\d+)%$", - progress_animation=False) + disable_progress_bar_animation=False) def main(): parser = GooeyParser(prog="example_progress_bar_1") _ = parser.parse_args(sys.argv[1:]) diff --git a/gooey/gui/windows/base_window.py b/gooey/gui/windows/base_window.py index 647e241..732c733 100644 --- a/gooey/gui/windows/base_window.py +++ b/gooey/gui/windows/base_window.py @@ -63,6 +63,12 @@ class BaseWindow(wx.Frame): self.runtime_display = RuntimeDisplay(self, self.build_spec) self.foot_panel = footer.Footer(self) + + if self.build_spec['disable_stop_button']: + self.foot_panel.stop_button.Disable() + else: + self.foot_panel.stop_button.Enable() + self.panels = [self.head_panel, self.config_panel, self.foot_panel] def _do_layout(self): @@ -163,7 +169,8 @@ class BaseWindow(wx.Frame): value = min(int(value), pb.GetRange()) if pb.GetValue() != value: # Windows 7 progress bar animation hack - if not self.build_spec["progress_animation"] \ + # http://stackoverflow.com/questions/5332616/disabling-net-progressbar-animation-when-changing-value + if not self.build_spec["disable_progress_bar_animation"] \ and sys.platform.startswith("win"): if pb.GetRange() == value: pb.SetValue(value) diff --git a/gooey/python_bindings/config_generator.py b/gooey/python_bindings/config_generator.py index 06d8e93..1918596 100644 --- a/gooey/python_bindings/config_generator.py +++ b/gooey/python_bindings/config_generator.py @@ -28,7 +28,8 @@ def create_from_parser(parser, source_path, **kwargs): 'monospace_display': kwargs.get('monospace_display', False), 'progress_regex': kwargs.get('progress_regex'), 'progress_expr': kwargs.get('progress_expr'), - 'progress_animation': kwargs.get('progress_animation'), + 'disable_progress_bar_animation': kwargs.get('disable_progress_bar_animation'), + 'disable_stop_button': kwargs.get('disable_stop_button'), } if show_config: diff --git a/gooey/python_bindings/gooey_decorator.py b/gooey/python_bindings/gooey_decorator.py index f048459..dbe942d 100644 --- a/gooey/python_bindings/gooey_decorator.py +++ b/gooey/python_bindings/gooey_decorator.py @@ -36,7 +36,8 @@ def Gooey(f=None, monospace_display=False, progress_regex=None, progress_expr=None, - progress_animation=True): + disable_progress_bar_animation=False, + disable_stop_button=False): ''' Decorator for client code's main function. Serializes argparse data to JSON for use with the Gooey front end