Browse Source

Plane updates

pull/1/head
unknown 11 years ago
parent
commit
87dc020389
19 changed files with 115 additions and 47 deletions
  1. BIN
      src/app/__init__.pyc
  2. BIN
      src/app/dialogs/__init__.pyc
  3. 19
      src/app/dialogs/advanced_config.py
  4. BIN
      src/app/dialogs/advanced_config.pyc
  5. 32
      src/app/dialogs/base_window.py
  6. BIN
      src/app/dialogs/component_factory.pyc
  7. 14
      src/app/dialogs/component_register.py
  8. 41
      src/app/dialogs/controller.py
  9. 2
      src/app/dialogs/display_main.py
  10. 10
      src/app/dialogs/footer.py
  11. BIN
      src/app/dialogs/footer.pyc
  12. 13
      src/app/dialogs/header.py
  13. BIN
      src/app/dialogs/header.pyc
  14. BIN
      src/app/images/__init__.pyc
  15. 14
      src/app/images/image_store.py
  16. BIN
      src/app/images/image_store.pyc
  17. BIN
      src/model/__init__.pyc
  18. 17
      src/model/controller.py
  19. BIN
      src/model/controller.pyc

BIN
src/app/__init__.pyc

BIN
src/app/dialogs/__init__.pyc

19
src/app/dialogs/advanced_config.py

@ -25,11 +25,16 @@ class AdvancedConfigPanel(ScrolledPanel, OptionReader):
self.components = ComponentFactory(parser) self.components = ComponentFactory(parser)
self._msg_req_args = self.BuildHeaderMsg("Required Arguments")
self._msg_opt_args = self.BuildHeaderMsg("Optional Arguments")
self._controller = None
self._init_components()
self._do_layout() self._do_layout()
self.Bind(wx.EVT_SIZE, self.OnResize) self.Bind(wx.EVT_SIZE, self.OnResize)
def _init_components(self):
self._msg_req_args = self.BuildHeaderMsg("Required Arguments")
self._msg_opt_args = self.BuildHeaderMsg("Optional Arguments")
def _do_layout(self): def _do_layout(self):
STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, PADDING) STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, PADDING)
@ -88,12 +93,20 @@ class AdvancedConfigPanel(ScrolledPanel, OptionReader):
for component in self.components: for component in self.components:
component.Update(evt.m_size) component.Update(evt.m_size)
evt.Skip() evt.Skip()
def RegisterController(self, controller):
if self._controller is None:
self._controller = controller
def GetOptions(self): def GetOptions(self):
''' '''
returns the collective values from all of the returns the collective values from all of the
widgets contained in the panel''' widgets contained in the panel'''
raise NotImplementedError
values = [(c._action, c.GetValue())
for c in self.components]
for i in values:
print (i[0].option_strings[-1], i[-1])

BIN
src/app/dialogs/advanced_config.pyc

32
src/app/dialogs/base_window.py

@ -1,6 +1,12 @@
''' '''
Created on Jan 19, 2014 Created on Jan 19, 2014
New plan:
fuck the multi-component thing.
Bind and unbind the buttons on the panels.
@author: Chris @author: Chris
''' '''
@ -8,7 +14,7 @@ import os
import wx import wx
import header import header
import footer import footer
from model.controller import Controller
from app.dialogs.controller import Controller
from app.images import image_store from app.images import image_store
class BaseWindow(wx.Frame): class BaseWindow(wx.Frame):
@ -23,11 +29,13 @@ class BaseWindow(wx.Frame):
) )
self._parser = parser self._parser = parser
self._controller = Controller()
self._controller = None
self._init_properties() self._init_properties()
self._init_components(BodyPanel) self._init_components(BodyPanel)
self._do_layout() self._do_layout()
self._init_controller()
self.registerControllers()
def _init_properties(self): def _init_properties(self):
self.SetMinSize((400,300)) self.SetMinSize((400,300))
@ -44,6 +52,8 @@ class BaseWindow(wx.Frame):
size=(30,90)) size=(30,90))
self.body_panel = BodyPanel(self, self._parser) self.body_panel = BodyPanel(self, self._parser)
self.cfg_foot_panel = footer.ConfigFooter(self, self._controller) self.cfg_foot_panel = footer.ConfigFooter(self, self._controller)
self.panels = [self.head_panel, self.body_panel, self.cfg_foot_panel]
# self.main_foot_panel = footer.MainFooter(self, self._controller) # self.main_foot_panel = footer.MainFooter(self, self._controller)
# self.main_foot_panel.Hide() # self.main_foot_panel.Hide()
@ -56,18 +66,22 @@ class BaseWindow(wx.Frame):
sizer.Add(self.cfg_foot_panel, 0, wx.EXPAND) sizer.Add(self.cfg_foot_panel, 0, wx.EXPAND)
self.SetSizer(sizer) self.SetSizer(sizer)
# def _init_panels(self):
# self._frame_header = FrameHeader
# self._basic_config_body = None
# self._adv_config_body = None
# self._config_footer = None
# self._output_footer = None
def _draw_horizontal_line(self, sizer): def _draw_horizontal_line(self, sizer):
line = wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL) line = wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL)
line.SetSize((10, 10)) line.SetSize((10, 10))
sizer.Add(line, 0, wx.EXPAND) sizer.Add(line, 0, wx.EXPAND)
def _init_controller(self):
self._controller = Controller(
base = self,
head_panel = self.head_panel,
body_panel = self.body_panel,
footer_panel = self.cfg_foot_panel)
def registerControllers(self):
for panel in self.panels:
panel.RegisterController(self._controller)

BIN
src/app/dialogs/component_factory.pyc

14
src/app/dialogs/component_register.py

@ -0,0 +1,14 @@
'''
Created on Jan 20, 2014
@author: Chris
'''
class ComponentRegister(object):
def __init__(self, params):
pass
def Registercontroller(self, controller):
if self._controller in None:
self._controller = controller

41
src/app/dialogs/controller.py

@ -0,0 +1,41 @@
'''
Created on Dec 22, 2013
@author: Chris
'''
class Controller(object):
'''
Main controller for the gui.
All controlls are delegated to this central control point.
It's kind of a bi-directional observer sort of thing, thus
weirdly initialized with references to the BaseWindows panels,
and then 'registered' with the panels .
Args:
base = Reference to the Basewindow
head_panel = reference to the BaseWindow's Head Panel
body_panel = reference to the BaseWindow's Body Panel
footer_panel = reference to the BaseWindow's Footer Panel
'''
def __init__(self, base, head_panel, body_panel, footer_panel):
self._base = base
self._head = head_panel
self._body = body_panel
self._foot = footer_panel
def OnConfigCancel(self, event):
print 'OnCongigCancel pressed!'
def OnConfigNext(self, event):
self._body.GetOptions()
def OnMainCancel(self, event):
print 'OnMaingCancel pressed!'
def OnMainNext(self, event):
print 'OnCongigNext pressed!'

2
src/app/dialogs/display_main.py

@ -8,7 +8,7 @@ import wx
import os import os
import sys import sys
import threading import threading
from model.controller import Controller
from app.dialogs.controller import Controller
from app.images import image_store from app.images import image_store
from app.dialogs.header import FrameHeader from app.dialogs.header import FrameHeader
from app.dialogs.basic_config_panel import BasicDisplayPanel from app.dialogs.basic_config_panel import BasicDisplayPanel

10
src/app/dialogs/footer.py

@ -14,6 +14,8 @@ class AbstractFooter(wx.Panel):
wx.Panel.__init__(self, parent, **kwargs) wx.Panel.__init__(self, parent, **kwargs)
self.SetMinSize((30, 53)) self.SetMinSize((30, 53))
self._controller = None
self.cancel_button = self._button('Cancel', wx.ID_CANCEL) self.cancel_button = self._button('Cancel', wx.ID_CANCEL)
self.next_button = self._button("Next", wx.ID_OK) self.next_button = self._button("Next", wx.ID_OK)
@ -40,6 +42,10 @@ class AbstractFooter(wx.Panel):
label=label, label=label,
style=style) style=style)
def RegisterController(self, controller):
if self._controller is None:
self._controller = controller
class ConfigFooter(AbstractFooter): class ConfigFooter(AbstractFooter):
''' '''
@ -54,8 +60,6 @@ class ConfigFooter(AbstractFooter):
def __init__(self, parent, controller, **kwargs): def __init__(self, parent, controller, **kwargs):
AbstractFooter.__init__(self, parent, **kwargs) AbstractFooter.__init__(self, parent, **kwargs)
self._controller = controller
self.Bind(wx.EVT_BUTTON, self.OnConfigCancel, self.cancel_button) self.Bind(wx.EVT_BUTTON, self.OnConfigCancel, self.cancel_button)
self.Bind(wx.EVT_BUTTON, self.OnConfigNext, self.next_button) self.Bind(wx.EVT_BUTTON, self.OnConfigNext, self.next_button)
@ -78,8 +82,6 @@ class MainFooter(AbstractFooter):
def __init__(self, parent, controller, **kwargs): def __init__(self, parent, controller, **kwargs):
AbstractFooter.__init__(self, parent, **kwargs) AbstractFooter.__init__(self, parent, **kwargs)
self._controller = controller
self.Bind(wx.EVT_BUTTON, self.OnConfigCancel, self.cancel_button) self.Bind(wx.EVT_BUTTON, self.OnConfigCancel, self.cancel_button)
self.Bind(wx.EVT_BUTTON, self.OnConfigNext, self.next_button) self.Bind(wx.EVT_BUTTON, self.OnConfigNext, self.next_button)

BIN
src/app/dialogs/footer.pyc

13
src/app/dialogs/header.py

@ -21,6 +21,8 @@ class FrameHeader(wx.Panel):
wx.Panel.__init__(self, **kwargs) wx.Panel.__init__(self, **kwargs)
self._controller = None
self._init_properties() self._init_properties()
self._init_components(heading, subheading, image_path) self._init_components(heading, subheading, image_path)
self._do_layout() self._do_layout()
@ -33,10 +35,7 @@ class FrameHeader(wx.Panel):
def _init_components(self, heading, subheading, image_path): def _init_components(self, heading, subheading, image_path):
self.header = self._bold_static_text(heading) self.header = self._bold_static_text(heading)
self.subheader = wx.StaticText(self, label=subheading) self.subheader = wx.StaticText(self, label=subheading)
self.img = wx.BitmapFromImage(imageutil.LoadAndResizeImage(image_path))
print '\n'
print 'Image returned from original method:', type(self._load_image(image_path))
print 'image returned from imageutil', type(self.img)
self.img = self._load_image(image_path)
def _do_layout(self): def _do_layout(self):
vsizer = wx.BoxSizer(wx.VERTICAL) vsizer = wx.BoxSizer(wx.VERTICAL)
@ -87,10 +86,12 @@ class FrameHeader(wx.Panel):
) )
return wx.BitmapFromImage(image) return wx.BitmapFromImage(image)
def UpdateImage(self, image): def UpdateImage(self, image):
pass pass
def RegisterController(self, controller):
if self._controller is None:
self._controller = controller

BIN
src/app/dialogs/header.pyc

BIN
src/app/images/__init__.pyc

14
src/app/images/image_store.py

@ -7,10 +7,10 @@ Convenience module for keeping the filepaths in one place.
""" """
computer = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\computer.png"
computer2 = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\computer2.png"
computer3 = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\computer3.png"
icon = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\icon.ico"
settings = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\settings.png"
settings2 = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\settings2.png"
terminal = r"C:\Users\Chris\Dropbox\pretty_gui\Gooey\src\app\images\terminal.png"
computer = r"C:\Users\Chris\Documents\Gooey\src\app\images\computer.png"
computer2 = r"C:\Users\Chris\Documents\Gooey\src\app\images\computer2.png"
computer3 = r"C:\Users\Chris\Documents\Gooey\src\app\images\computer3.png"
icon = r"C:\Users\Chris\Documents\Gooey\src\app\images\icon.ico"
settings = r"C:\Users\Chris\Documents\Gooey\src\app\images\settings.png"
settings2 = r"C:\Users\Chris\Documents\Gooey\src\app\images\settings2.png"
terminal = r"C:\Users\Chris\Documents\Gooey\src\app\images\terminal.png"

BIN
src/app/images/image_store.pyc

BIN
src/model/__init__.pyc

17
src/model/controller.py

@ -1,17 +0,0 @@
'''
Created on Dec 22, 2013
@author: Chris
'''
class Controller(object):
'''
Main controller for the gui.
Serves as a delagation for all of the various buttons/panels/events.
'''
def __init__(self):
pass

BIN
src/model/controller.pyc

Loading…
Cancel
Save