summaryrefslogtreecommitdiff
path: root/gr-wxgui/src/python/term_window.py
diff options
context:
space:
mode:
authorJohnathan Corgan2009-10-21 17:11:03 -0700
committerJohnathan Corgan2009-10-29 07:00:35 -0700
commitab901e7d4cb6e5e8b1b46dac8a7af74acf72cb8c (patch)
tree3da5ab0f9a121b476789f4985d09d2d39b34320d /gr-wxgui/src/python/term_window.py
parent00613b260a36923509eab1811256815269dcd99c (diff)
downloadgnuradio-ab901e7d4cb6e5e8b1b46dac8a7af74acf72cb8c.tar.gz
gnuradio-ab901e7d4cb6e5e8b1b46dac8a7af74acf72cb8c.tar.bz2
gnuradio-ab901e7d4cb6e5e8b1b46dac8a7af74acf72cb8c.zip
Basic terminal window that takes raw text on input msgq and appends it
Works, but needs "--line-buffered" mode for GR buffering between blocks
Diffstat (limited to 'gr-wxgui/src/python/term_window.py')
-rw-r--r--gr-wxgui/src/python/term_window.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/gr-wxgui/src/python/term_window.py b/gr-wxgui/src/python/term_window.py
index 8658e54a6..77270b1f3 100644
--- a/gr-wxgui/src/python/term_window.py
+++ b/gr-wxgui/src/python/term_window.py
@@ -20,17 +20,27 @@
#
import wx
-import pubsub
DEFAULT_WIN_SIZE = (600, 300)
+APPEND_EVENT = wx.NewEventType()
+EVT_APPEND_EVENT = wx.PyEventBinder(APPEND_EVENT, 0)
-class term_window(wx.Panel, pubsub.pubsub):
+class AppendEvent(wx.PyEvent):
+ def __init__(self, text):
+ wx.PyEvent.__init__(self)
+ self.SetEventType(APPEND_EVENT)
+ self.text = text
+
+ def Clone(self):
+ self.__class__(self.GetId())
+
+
+class term_window(wx.Panel):
def __init__(self,
parent,
size,
):
- pubsub.pubsub.__init__(self)
wx.Panel.__init__(self,
parent,
size=size,
@@ -39,7 +49,7 @@ class term_window(wx.Panel, pubsub.pubsub):
self.text_ctrl = wx.TextCtrl(self,
wx.ID_ANY,
- value="BOO",
+ value="",
size=size,
style=wx.TE_MULTILINE|wx.TE_READONLY,
)
@@ -47,3 +57,14 @@ class term_window(wx.Panel, pubsub.pubsub):
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(self.text_ctrl, 1, wx.EXPAND)
self.SetSizerAndFit(main_sizer)
+
+ EVT_APPEND_EVENT(self, self.evt_append)
+
+ def append_text(self, text):
+ evt = AppendEvent(text)
+ wx.PostEvent(self, evt)
+ del evt
+
+ def evt_append(self, evt):
+ print "appending", len(evt.text), "bytes"
+ self.text_ctrl.AppendText(evt.text)