From 55c5790ba30615b97ff6f76bf8228ea89f48ae59 Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Thu, 7 Jan 2016 22:53:29 -0500 Subject: [PATCH] Removing legacy build.spec referecnes --- gooey/gui/controller.py | 6 +++--- gooey/gui/model.py | 3 ++- gooey/gui/presenter.py | 2 -- gooey/gui/windows/advanced_config.py | 2 +- gooey/gui/windows/base_window.py | 15 ++------------- gooey/gui/windows/layouts.py | 7 +++---- 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/gooey/gui/controller.py b/gooey/gui/controller.py index 548fdc6..ce6ae45 100644 --- a/gooey/gui/controller.py +++ b/gooey/gui/controller.py @@ -9,9 +9,9 @@ NO = 5104 class Controller(object): def __init__(self, build_spec): - self.build_spec = build_spec - self.view = BaseWindow(build_spec, layout_type=self.build_spec['layout_type']) - self.presentation = Presenter(self.view, MyModel(self.build_spec)) + self.model = MyModel(build_spec) + self.view = BaseWindow(layout_type=self.model.layout_type) + self.presentation = Presenter(self.view, self.model) self.presentation.initialize_view() diff --git a/gooey/gui/model.py b/gooey/gui/model.py index 6304e44..ccb69b0 100644 --- a/gooey/gui/model.py +++ b/gooey/gui/model.py @@ -90,6 +90,7 @@ class MyModel(object): self.current_state = States.CONFIGURING self.build_spec = build_spec + self.layout_type = self.build_spec['layout_type'] self.progress_regex = self.build_spec['progress_regex'] self.progress_expr = self.build_spec['progress_expr'] self.program_name = self.build_spec['program_name'] @@ -101,7 +102,7 @@ class MyModel(object): self.use_monospace_font = self.build_spec.get('monospace_display') self.stop_button_disabled = self.build_spec['disable_stop_button'] - reqs, opts = self.group_arguments(self.build_spec['widgets']) + reqs, opts = self.group_arguments(self.build_spec.get('widgets', [])) self.required_args = reqs self.optional_args = opts diff --git a/gooey/gui/presenter.py b/gooey/gui/presenter.py index 12e91ee..9b7ab95 100644 --- a/gooey/gui/presenter.py +++ b/gooey/gui/presenter.py @@ -54,8 +54,6 @@ class Presenter(object): # update heading titles self.view.heading_title = self.model.heading_title self.view.heading_subtitle = self.model.heading_subtitle - if not self.model.stop_button_disabled: - self.view.enable_stop_button() # refresh the widgets for index, widget in enumerate(self.view.required_section): diff --git a/gooey/gui/windows/advanced_config.py b/gooey/gui/windows/advanced_config.py index 8c3db10..ef354d3 100644 --- a/gooey/gui/windows/advanced_config.py +++ b/gooey/gui/windows/advanced_config.py @@ -75,7 +75,7 @@ class WidgetContainer(wx.Panel): class ConfigPanel(ScrolledPanel): - def __init__(self, parent, widgets=None, req_cols=1, opt_cols=3, title=None, **kwargs): + def __init__(self, parent, req_cols=1, opt_cols=3, title=None, **kwargs): ScrolledPanel.__init__(self, parent, **kwargs) self.SetupScrolling(scroll_x=False, scrollToTop=False) diff --git a/gooey/gui/windows/base_window.py b/gooey/gui/windows/base_window.py index b48ff2c..41a3872 100644 --- a/gooey/gui/windows/base_window.py +++ b/gooey/gui/windows/base_window.py @@ -21,11 +21,9 @@ YES = 5103 NO = 5104 class BaseWindow(wx.Frame): - def __init__(self, build_spec, layout_type): + def __init__(self, layout_type): wx.Frame.__init__(self, parent=None, id=-1) - self.build_spec = build_spec - self.SetDoubleBuffered(True) # type of gui to render @@ -178,7 +176,7 @@ class BaseWindow(wx.Frame): if self.layout_type == layouts.COLUMN: self.config_panel = layouts.ColumnLayout(self) else: - self.config_panel = layouts.FlatLayout(self, build_spec=self.build_spec) + self.config_panel = layouts.FlatLayout(self) sizer.Add(self.config_panel, 1, wx.EXPAND) @@ -191,15 +189,6 @@ class BaseWindow(wx.Frame): self.sizer = sizer - pub.subscribe(self.myListener, "panelListener") - # pub.subscribe(self.load_view, events.WINDOW_CHANGE) - - - - def myListener(self, message): - if message == 'fetch': - del self.config_panel - def GetOptions(self): return self.config_panel.GetOptions() diff --git a/gooey/gui/windows/layouts.py b/gooey/gui/windows/layouts.py index ceca1a4..a2bfcd9 100644 --- a/gooey/gui/windows/layouts.py +++ b/gooey/gui/windows/layouts.py @@ -1,5 +1,6 @@ -from collections import OrderedDict import wx + +from collections import OrderedDict from gooey.gui.pubsub import pub from gooey.gui import events @@ -31,12 +32,10 @@ COLUMN = 'column' class FlatLayout(wx.Panel): def __init__(self, *args, **kwargs): - self._build_spec = kwargs.pop('build_spec', None) super(FlatLayout, self).__init__(*args, **kwargs) self.SetDoubleBuffered(True) - # self.main_content = ConfigPanel(self, widgets=self._build_spec['widgets'], opt_cols=self._build_spec['num_optional_cols']) - self.main_content = ConfigPanel(self, widgets=self._build_spec['widgets'], opt_cols=3) + self.main_content = ConfigPanel(self, opt_cols=3) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.main_content, 3, wx.EXPAND)