Browse Source

option to disable stop button

pull/120/head
Alexander Gordeyev 9 years ago
parent
commit
39d804fd28
5 changed files with 14 additions and 5 deletions
  1. 2
      gooey/_tmp/example_progress_bar_2.py
  2. 2
      gooey/_tmp/example_progress_bar_4.py
  3. 9
      gooey/gui/windows/base_window.py
  4. 3
      gooey/python_bindings/config_generator.py
  5. 3
      gooey/python_bindings/gooey_decorator.py

2
gooey/_tmp/example_progress_bar_2.py

@ -10,7 +10,7 @@ from gooey import Gooey, GooeyParser
@Gooey(progress_regex=r"^progress: (\d+)/(\d+)$", @Gooey(progress_regex=r"^progress: (\d+)/(\d+)$",
progress_expr="x[0] / x[1] * 100", progress_expr="x[0] / x[1] * 100",
progress_animation=False)
disable_progress_bar_animation=False)
def main(): def main():
parser = GooeyParser(prog="example_progress_bar_2") parser = GooeyParser(prog="example_progress_bar_2")
parser.add_argument("steps", type=int, default=15) parser.add_argument("steps", type=int, default=15)

2
gooey/_tmp/example_progress_bar_4.py

@ -9,7 +9,7 @@ from gooey import Gooey, GooeyParser
@Gooey(progress_regex=r"^progress: (-?\d+)%$", @Gooey(progress_regex=r"^progress: (-?\d+)%$",
progress_animation=False)
disable_progress_bar_animation=False)
def main(): def main():
parser = GooeyParser(prog="example_progress_bar_1") parser = GooeyParser(prog="example_progress_bar_1")
_ = parser.parse_args(sys.argv[1:]) _ = parser.parse_args(sys.argv[1:])

9
gooey/gui/windows/base_window.py

@ -63,6 +63,12 @@ class BaseWindow(wx.Frame):
self.runtime_display = RuntimeDisplay(self, self.build_spec) self.runtime_display = RuntimeDisplay(self, self.build_spec)
self.foot_panel = footer.Footer(self) 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] self.panels = [self.head_panel, self.config_panel, self.foot_panel]
def _do_layout(self): def _do_layout(self):
@ -163,7 +169,8 @@ class BaseWindow(wx.Frame):
value = min(int(value), pb.GetRange()) value = min(int(value), pb.GetRange())
if pb.GetValue() != value: if pb.GetValue() != value:
# Windows 7 progress bar animation hack # 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"): and sys.platform.startswith("win"):
if pb.GetRange() == value: if pb.GetRange() == value:
pb.SetValue(value) pb.SetValue(value)

3
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), 'monospace_display': kwargs.get('monospace_display', False),
'progress_regex': kwargs.get('progress_regex'), 'progress_regex': kwargs.get('progress_regex'),
'progress_expr': kwargs.get('progress_expr'), '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: if show_config:

3
gooey/python_bindings/gooey_decorator.py

@ -36,7 +36,8 @@ def Gooey(f=None,
monospace_display=False, monospace_display=False,
progress_regex=None, progress_regex=None,
progress_expr=None, progress_expr=None,
progress_animation=True):
disable_progress_bar_animation=False,
disable_stop_button=False):
''' '''
Decorator for client code's main function. Decorator for client code's main function.
Serializes argparse data to JSON for use with the Gooey front end Serializes argparse data to JSON for use with the Gooey front end

Loading…
Cancel
Save