Browse Source

Removing legacy build.spec referecnes

pull/150/head
chriskiehl 9 years ago
parent
commit
55c5790ba3
6 changed files with 11 additions and 24 deletions
  1. 6
      gooey/gui/controller.py
  2. 3
      gooey/gui/model.py
  3. 2
      gooey/gui/presenter.py
  4. 2
      gooey/gui/windows/advanced_config.py
  5. 15
      gooey/gui/windows/base_window.py
  6. 7
      gooey/gui/windows/layouts.py

6
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()

3
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

2
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):

2
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)

15
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()

7
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)

Loading…
Cancel
Save