From fe6eb525214f4e60e0642646b732a7acbbddca92 Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Thu, 24 Dec 2015 16:44:28 -0500 Subject: [PATCH] project cleanup --- gooey/gui/controller.py | 2 +- gooey/gui/windows/base_window.py | 2 +- gooey/gui/windows/runtime_display_panel.py | 39 ++++------------------ 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/gooey/gui/controller.py b/gooey/gui/controller.py index 245d48c..7b0b4b7 100644 --- a/gooey/gui/controller.py +++ b/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 diff --git a/gooey/gui/windows/base_window.py b/gooey/gui/windows/base_window.py index 31d9f6d..643d4a4 100644 --- a/gooey/gui/windows/base_window.py +++ b/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 diff --git a/gooey/gui/windows/runtime_display_panel.py b/gooey/gui/windows/runtime_display_panel.py index 5c544a9..94e67ba 100644 --- a/gooey/gui/windows/runtime_display_panel.py +++ b/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