From b5253652ad2460857ee30f66c04de4e6b044da0b Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Thu, 14 Jan 2016 20:19:17 -0500 Subject: [PATCH] Issue #142 - AttributeError on build_spec --- gooey/gui/model.py | 1 + gooey/gui/presenter.py | 2 +- gooey/gui/windows/base_window.py | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gooey/gui/model.py b/gooey/gui/model.py index db331ee..5101178 100644 --- a/gooey/gui/model.py +++ b/gooey/gui/model.py @@ -111,6 +111,7 @@ class MyModel(object): self.auto_start = self.build_spec.get('auto_start') self.progress_regex = self.build_spec.get('progress_regex') self.progress_expr = self.build_spec.get('progress_expr') + self.disable_progress_bar_animation = self.build_spec['disable_progress_bar_animation'] self.program_name = self.build_spec.get('program_name') self.default_size = self.build_spec.get('default_size') diff --git a/gooey/gui/presenter.py b/gooey/gui/presenter.py index 43242d6..77eaa9f 100644 --- a/gooey/gui/presenter.py +++ b/gooey/gui/presenter.py @@ -129,7 +129,7 @@ class Presenter(object): def on_progress_change(self, progress): # observes changes coming from the subprocess - self.view.update_progress_aync(progress) + self.view.update_progress_aync(progress, self.model.disable_progress_bar_animation) def on_client_done(self): if self.client_runner.was_success(): diff --git a/gooey/gui/windows/base_window.py b/gooey/gui/windows/base_window.py index 1cfe1f5..a20389f 100644 --- a/gooey/gui/windows/base_window.py +++ b/gooey/gui/windows/base_window.py @@ -178,8 +178,8 @@ class BaseWindow(wx.Frame): def update_console_async(self, msg): wx.CallAfter(self.runtime_display.append_text, msg) - def update_progress_aync(self, progress): - wx.CallAfter(self.UpdateProgressBar, progress) + def update_progress_aync(self, progress, disable_animation=False): + wx.CallAfter(self.UpdateProgressBar, progress, disable_animation) def onResize(self, evt): evt.Skip() @@ -189,7 +189,7 @@ class BaseWindow(wx.Frame): evt.Veto() pub.send_message(str(events.WINDOW_CLOSE)) - def UpdateProgressBar(self, value): + def UpdateProgressBar(self, value, disable_animation=False): pb = self.foot_panel.progress_bar if value < 0: pb.Pulse() @@ -198,8 +198,7 @@ class BaseWindow(wx.Frame): if pb.GetValue() != value: # Windows 7 progress bar animation hack # http://stackoverflow.com/questions/5332616/disabling-net-progressbar-animation-when-changing-value - if self.build_spec["disable_progress_bar_animation"] \ - and sys.platform.startswith("win"): + if disable_animation and sys.platform.startswith("win"): if pb.GetRange() == value: pb.SetValue(value) pb.SetValue(value-1)