Browse Source

project cleanup

pull/150/head
chriskiehl 9 years ago
parent
commit
fe6eb52521
3 changed files with 8 additions and 35 deletions
  1. 2
      gooey/gui/controller.py
  2. 2
      gooey/gui/windows/base_window.py
  3. 39
      gooey/gui/windows/runtime_display_panel.py

2
gooey/gui/controller.py

@ -11,6 +11,7 @@ from gooey.gui.lang import i18n
from gooey.gui import events
from gooey.gui.pubsub import pub
from gooey.gui.util.taskkill import taskkill
from gooey.gui.viewmodel import ViewModel
from gooey.gui.windows import views
from gooey.gui.windows.base_window import BaseWindow
@ -23,7 +24,6 @@ class Controller(object):
def __init__(self, build_spec):
# todo: model!
self.build_spec = build_spec
self.view = BaseWindow(build_spec)
self._process = None

2
gooey/gui/windows/base_window.py

@ -134,7 +134,7 @@ class BaseWindow(wx.Frame):
pub.send_message(str(events.WINDOW_CLOSE))
def PublishConsoleMsg(self, text):
self.runtime_display.cmd_textbox.AppendText(text)
self.runtime_display.append_text(text)
def UpdateProgressBar(self, value):
pb = self.foot_panel.progress_bar

39
gooey/gui/windows/runtime_display_panel.py

@ -4,43 +4,31 @@ Created on Dec 23, 2013
@author: Chris
'''
import sys
import wx
from gooey.gui.lang import i18n
from gooey.gui.message_event import EVT_MSG
class MessagePump(object):
def __init__(self):
# self.queue = queue
self.stdout = sys.stdout
# Overrides stdout's write method
def write(self, text):
raise NotImplementedError
class RuntimeDisplay(wx.Panel):
'''
Textbox displayed during the client program's execution.
'''
def __init__(self, parent, build_spec, **kwargs):
wx.Panel.__init__(self, parent, **kwargs)
self.build_spec = build_spec
self._init_properties()
self._init_components()
self._do_layout()
# self._HookStdout()
def _init_properties(self):
self.SetBackgroundColour('#F0F0F0')
def _init_components(self):
self.text = wx.StaticText(self, label=i18n._("status"))
self.cmd_textbox = wx.TextCtrl(
self, -1, "",
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
if self.build_spec.get('monospace_display'):
pointsize = self.cmd_textbox.GetFont().GetPointSize()
font = wx.Font(pointsize, wx.FONTFAMILY_MODERN,
@ -56,21 +44,6 @@ class RuntimeDisplay(wx.Panel):
sizer.AddSpacer(20)
self.SetSizer(sizer)
self.Bind(EVT_MSG, self.OnMsg)
def _HookStdout(self):
_stdout = sys.stdout
_stdout_write = _stdout.write
sys.stdout = MessagePump()
sys.stdout.write = self.WriteToDisplayBox
def AppendText(self, txt):
def append_text(self, txt):
self.cmd_textbox.AppendText(txt)
def WriteToDisplayBox(self, txt):
if txt is not '':
self.AppendText(txt)
def OnMsg(self, evt):
pass
Loading…
Cancel
Save