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.

50 lines
1.2 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. class RuntimeDisplay(wx.Panel):
  8. '''
  9. Textbox displayed during the client program's execution.
  10. '''
  11. def __init__(self, parent, **kwargs):
  12. wx.Panel.__init__(self, parent, **kwargs)
  13. self._init_properties()
  14. self._init_components()
  15. self._do_layout()
  16. def set_font_style(self, style):
  17. pointsize = self.cmd_textbox.GetFont().GetPointSize()
  18. font = wx.Font(pointsize, style,
  19. wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_BOLD, False)
  20. self.cmd_textbox.SetFont(font)
  21. def _init_properties(self):
  22. self.SetBackgroundColour('#F0F0F0')
  23. def _init_components(self):
  24. self.text = wx.StaticText(self, label=i18n._("status"))
  25. self.cmd_textbox = wx.TextCtrl(
  26. self, -1, "",
  27. style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
  28. def _do_layout(self):
  29. sizer = wx.BoxSizer(wx.VERTICAL)
  30. sizer.AddSpacer(10)
  31. sizer.Add(self.text, 0, wx.LEFT, 30)
  32. sizer.AddSpacer(10)
  33. sizer.Add(self.cmd_textbox, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 30)
  34. sizer.AddSpacer(20)
  35. self.SetSizer(sizer)
  36. def append_text(self, txt):
  37. self.cmd_textbox.AppendText(txt)