You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. '''
  2. Created on Dec 23, 2013
  3. @author: Chris
  4. '''
  5. import wx
  6. from gooey.gui.lang import i18n
  7. from gooey.gui.three_to_four import Constants
  8. class RuntimeDisplay(wx.Panel):
  9. '''
  10. Textbox displayed during the client program's execution.
  11. '''
  12. def __init__(self, parent, **kwargs):
  13. wx.Panel.__init__(self, parent, **kwargs)
  14. self._init_properties()
  15. self._init_components()
  16. self._do_layout()
  17. def set_font_style(self, style):
  18. pointsize = self.cmd_textbox.GetFont().GetPointSize()
  19. font = wx.Font(pointsize, style,
  20. Constants.WX_FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)
  21. self.cmd_textbox.SetFont(font)
  22. def _init_properties(self):
  23. self.SetBackgroundColour('#F0F0F0')
  24. def _init_components(self):
  25. self.text = wx.StaticText(self, label=i18n._("status"))
  26. self.cmd_textbox = wx.TextCtrl(
  27. self, -1, "",
  28. style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
  29. def _do_layout(self):
  30. sizer = wx.BoxSizer(wx.VERTICAL)
  31. sizer.AddSpacer(10)
  32. sizer.Add(self.text, 0, wx.LEFT, 30)
  33. sizer.AddSpacer(10)
  34. sizer.Add(self.cmd_textbox, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 30)
  35. sizer.AddSpacer(20)
  36. self.SetSizer(sizer)
  37. def append_text(self, txt):
  38. self.cmd_textbox.AppendText(txt)