From 92f2da3450b3ae0a5d16d322ad42c7812c4ffc62 Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <jcorgan@corganenterprises.com>
Date: Thu, 15 Oct 2009 09:11:59 -0700
Subject: Created skeleton wxgui term window component

---
 gr-wxgui/src/python/termsink.py | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 gr-wxgui/src/python/termsink.py

(limited to 'gr-wxgui/src/python/termsink.py')

diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
new file mode 100644
index 0000000000..92aba47f4f
--- /dev/null
+++ b/gr-wxgui/src/python/termsink.py
@@ -0,0 +1,38 @@
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import term_window
+import common
+from gnuradio import gr
+
+class termsink(gr.hier_block2, common.wxgui_hb):
+	def __init__(self,parent):
+		gr.hier_block2.__init__(
+			self,
+			"termsink",
+			gr.io_signature(0, 0, 0),
+			gr.io_signature(0, 0, 0),
+		)
+
+		self.win = term_window.term_window(
+			parent=parent,
+		)
+
-- 
cgit v1.2.3


From 00613b260a36923509eab1811256815269dcd99c Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <jcorgan@corganenterprises.com>
Date: Thu, 15 Oct 2009 11:00:30 -0700
Subject: Add placeholder panel for console, use old style window size

---
 gr-wxgui/src/python/term_window.py | 25 +++++++++++++++++++++++--
 gr-wxgui/src/python/termsink.py    |  7 +++++--
 2 files changed, 28 insertions(+), 4 deletions(-)

(limited to 'gr-wxgui/src/python/termsink.py')

diff --git a/gr-wxgui/src/python/term_window.py b/gr-wxgui/src/python/term_window.py
index cae19c07aa..8658e54a6e 100644
--- a/gr-wxgui/src/python/term_window.py
+++ b/gr-wxgui/src/python/term_window.py
@@ -22,7 +22,28 @@
 import wx
 import pubsub
 
+DEFAULT_WIN_SIZE = (600, 300)
+
 class term_window(wx.Panel, pubsub.pubsub):
-	def __init__(self, parent):
+	def __init__(self,
+		     parent,
+		     size,
+		     ):
+
 		pubsub.pubsub.__init__(self)
-		wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+		wx.Panel.__init__(self,
+				  parent,
+				  size=size,
+				  style=wx.SIMPLE_BORDER,
+				  )
+
+		self.text_ctrl = wx.TextCtrl(self,
+					     wx.ID_ANY,
+					     value="BOO",
+					     size=size,
+					     style=wx.TE_MULTILINE|wx.TE_READONLY,
+					)
+
+		main_sizer = wx.BoxSizer(wx.VERTICAL)
+		main_sizer.Add(self.text_ctrl, 1, wx.EXPAND)
+		self.SetSizerAndFit(main_sizer)
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
index 92aba47f4f..2c583b1150 100644
--- a/gr-wxgui/src/python/termsink.py
+++ b/gr-wxgui/src/python/termsink.py
@@ -24,7 +24,10 @@ import common
 from gnuradio import gr
 
 class termsink(gr.hier_block2, common.wxgui_hb):
-	def __init__(self,parent):
+	def __init__(self,
+		     parent,
+		     ):
+
 		gr.hier_block2.__init__(
 			self,
 			"termsink",
@@ -34,5 +37,5 @@ class termsink(gr.hier_block2, common.wxgui_hb):
 
 		self.win = term_window.term_window(
 			parent=parent,
+			size=term_window.DEFAULT_WIN_SIZE,
 		)
-
-- 
cgit v1.2.3


From ab901e7d4cb6e5e8b1b46dac8a7af74acf72cb8c Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <jcorgan@corganenterprises.com>
Date: Wed, 21 Oct 2009 17:11:03 -0700
Subject: Basic terminal window that takes raw text on input msgq and appends
 it

Works, but needs "--line-buffered" mode for GR buffering between blocks
---
 gr-wxgui/src/python/term_window.py | 29 +++++++++++++++++++++++++----
 gr-wxgui/src/python/termsink.py    | 26 ++++++++++++++------------
 grc/blocks/wxgui_termsink.xml      | 25 ++++++++++++++++++++++++-
 3 files changed, 63 insertions(+), 17 deletions(-)

(limited to 'gr-wxgui/src/python/termsink.py')

diff --git a/gr-wxgui/src/python/term_window.py b/gr-wxgui/src/python/term_window.py
index 8658e54a6e..77270b1f36 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)
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
index 2c583b1150..addfa58101 100644
--- a/gr-wxgui/src/python/termsink.py
+++ b/gr-wxgui/src/python/termsink.py
@@ -20,22 +20,24 @@
 #
 
 import term_window
-import common
-from gnuradio import gr
+from gnuradio import gru
 
-class termsink(gr.hier_block2, common.wxgui_hb):
+class termsink(object):
 	def __init__(self,
 		     parent,
+		     msgq,
+		     size=term_window.DEFAULT_WIN_SIZE,
 		     ):
-
-		gr.hier_block2.__init__(
-			self,
-			"termsink",
-			gr.io_signature(0, 0, 0),
-			gr.io_signature(0, 0, 0),
-		)
-
+		
 		self.win = term_window.term_window(
 			parent=parent,
-			size=term_window.DEFAULT_WIN_SIZE,
+			size=size,
 		)
+
+		self.runner = gru.msgq_runner(msgq, self.handle_msg)
+
+	def handle_msg(self, msg):
+		# Just append text for now
+		text = msg.to_string()
+		print "handle_msg: received", len(text), "bytes"
+		self.win.append_text(text)
diff --git a/grc/blocks/wxgui_termsink.xml b/grc/blocks/wxgui_termsink.xml
index e1d52cd175..fce7577de9 100644
--- a/grc/blocks/wxgui_termsink.xml
+++ b/grc/blocks/wxgui_termsink.xml
@@ -7,26 +7,49 @@
 <block>
 	<name>Terminal Sink</name>
 	<key>wxgui_termsink</key>
+
 	<import>from gnuradio.wxgui import termsink</import>
+
 	<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
 termsink.termsink(
-	$(parent).GetWin(),
+	parent=$(parent).GetWin(),
+#if $win_size()
+	size=$win_size,
+#end if
+	msgq=$(id)_msgq,
 )
 #if not $grid_pos()
 $(parent).Add(self.$(id).win)
 #else
 $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
+
+	<param>
+		<name>Window Size</name>
+		<key>win_size</key>
+		<value></value>
+		<type>int_vector</type>
+		<hide>#if $win_size() then 'none' else 'part'#</hide>
+	</param>
 	<param>
 		<name>Grid Position</name>
 		<key>grid_pos</key>
 		<value></value>
 		<type>grid_pos</type>
 	</param>
+
 	<param>
 		<name>Notebook</name>
 		<key>notebook</key>
 		<value></value>
 		<type>notebook</type>
 	</param>
+
+	<check>not $win_size or len($win_size) == 2</check>
+
+	<sink>
+		<name>in</name>
+		<type>msg</type>
+	</sink>
+	
 </block>
-- 
cgit v1.2.3


From 6f0685769f7a7728a779502435cd2dd17b8d65e2 Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <jcorgan@corganenterprises.com>
Date: Thu, 29 Oct 2009 07:26:39 -0700
Subject: Consolidated termsink into one class

---
 gr-wxgui/src/python/Makefile.am    | 11 +++---
 gr-wxgui/src/python/term_window.py | 70 --------------------------------------
 gr-wxgui/src/python/termsink.py    | 56 ++++++++++++++++++++++++------
 grc/blocks/wxgui_termsink.xml      |  8 ++---
 4 files changed, 55 insertions(+), 90 deletions(-)
 delete mode 100644 gr-wxgui/src/python/term_window.py

(limited to 'gr-wxgui/src/python/termsink.py')

diff --git a/gr-wxgui/src/python/Makefile.am b/gr-wxgui/src/python/Makefile.am
index 0b4550b381..dfa156f626 100644
--- a/gr-wxgui/src/python/Makefile.am
+++ b/gr-wxgui/src/python/Makefile.am
@@ -1,23 +1,23 @@
 #
 # Copyright 2004,2005,2008 Free Software Foundation, Inc.
-# 
+#
 # This file is part of GNU Radio
-# 
+#
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3, or (at your option)
 # any later version.
-# 
+#
 # GNU Radio is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with GNU Radio; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 51 Franklin Street,
 # Boston, MA 02110-1301, USA.
-# 
+#
 
 include $(top_srcdir)/Makefile.common
 
@@ -53,7 +53,6 @@ ourpython_PYTHON =			\
 	scopesink_nongl.py		\
 	scopesink_gl.py			\
 	scope_window.py			\
-	term_window.py			\
 	termsink.py			\
 	waterfallsink2.py		\
 	waterfallsink_nongl.py		\
diff --git a/gr-wxgui/src/python/term_window.py b/gr-wxgui/src/python/term_window.py
deleted file mode 100644
index 77270b1f36..0000000000
--- a/gr-wxgui/src/python/term_window.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Copyright 2009 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-import wx
-
-DEFAULT_WIN_SIZE = (600, 300)
-APPEND_EVENT = wx.NewEventType()
-EVT_APPEND_EVENT = wx.PyEventBinder(APPEND_EVENT, 0)
-
-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,
-		     ):
-
-		wx.Panel.__init__(self,
-				  parent,
-				  size=size,
-				  style=wx.SIMPLE_BORDER,
-				  )
-
-		self.text_ctrl = wx.TextCtrl(self,
-					     wx.ID_ANY,
-					     value="",
-					     size=size,
-					     style=wx.TE_MULTILINE|wx.TE_READONLY,
-					)
-
-		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)
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
index addfa58101..45a94e3965 100644
--- a/gr-wxgui/src/python/termsink.py
+++ b/gr-wxgui/src/python/termsink.py
@@ -19,25 +19,61 @@
 # Boston, MA 02110-1301, USA.
 #
 
-import term_window
 from gnuradio import gru
+import wx
 
-class termsink(object):
+DEFAULT_WIN_SIZE = (600, 300)
+APPEND_EVENT = wx.NewEventType()
+EVT_APPEND_EVENT = wx.PyEventBinder(APPEND_EVENT, 0)
+
+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 termsink(wx.Panel):
 	def __init__(self,
 		     parent,
 		     msgq,
-		     size=term_window.DEFAULT_WIN_SIZE,
+		     size=DEFAULT_WIN_SIZE,
 		     ):
-		
-		self.win = term_window.term_window(
-			parent=parent,
-			size=size,
-		)
 
+		wx.Panel.__init__(self,
+				  parent,
+				  size=size,
+				  style=wx.SIMPLE_BORDER,
+				  )
+
+		self.text_ctrl = wx.TextCtrl(self,
+					     wx.ID_ANY,
+					     value="",
+					     size=size,
+					     style=wx.TE_MULTILINE|wx.TE_READONLY,
+					     )
+
+		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)
 		self.runner = gru.msgq_runner(msgq, self.handle_msg)
 
 	def handle_msg(self, msg):
-		# Just append text for now
+		# This gets called in the queue runner thread context
+		# For now, just add whatever the user sends to the text control
 		text = msg.to_string()
 		print "handle_msg: received", len(text), "bytes"
-		self.win.append_text(text)
+
+		# Create a wxPython event and post it to the event queue
+		evt = AppendEvent(text)
+		wx.PostEvent(self, evt)
+		del evt
+
+        def evt_append(self, evt):
+		# This gets called by the wxPython event queue runner
+		print "appending", len(evt.text), "bytes"
+		self.text_ctrl.AppendText(evt.text)
diff --git a/grc/blocks/wxgui_termsink.xml b/grc/blocks/wxgui_termsink.xml
index fce7577de9..985d89b58e 100644
--- a/grc/blocks/wxgui_termsink.xml
+++ b/grc/blocks/wxgui_termsink.xml
@@ -16,12 +16,12 @@ termsink.termsink(
 #if $win_size()
 	size=$win_size,
 #end if
-	msgq=$(id)_msgq,
+	msgq=$(id)_msgq_in,
 )
 #if not $grid_pos()
-$(parent).Add(self.$(id).win)
+$(parent).Add(self.$(id))
 #else
-$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+$(parent).GridAdd(self.$(id), $(', '.join(map(str, $grid_pos()))))
 #end if</make>
 
 	<param>
@@ -51,5 +51,5 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 		<name>in</name>
 		<type>msg</type>
 	</sink>
-	
+
 </block>
-- 
cgit v1.2.3


From 392b7f9002cb08dddc1ca0ced18f899a0958ba1f Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <jcorgan@corganenterprises.com>
Date: Tue, 3 Nov 2009 07:11:45 -0800
Subject: gr-wxgui: cleanup for merge

---
 gr-wxgui/src/python/Makefile.am | 2 +-
 gr-wxgui/src/python/termsink.py | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

(limited to 'gr-wxgui/src/python/termsink.py')

diff --git a/gr-wxgui/src/python/Makefile.am b/gr-wxgui/src/python/Makefile.am
index dfa156f626..2382d599c0 100644
--- a/gr-wxgui/src/python/Makefile.am
+++ b/gr-wxgui/src/python/Makefile.am
@@ -1,5 +1,5 @@
 #
-# Copyright 2004,2005,2008 Free Software Foundation, Inc.
+# Copyright 2004,2005,2008,2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
index 45a94e3965..a0cfd575d6 100644
--- a/gr-wxgui/src/python/termsink.py
+++ b/gr-wxgui/src/python/termsink.py
@@ -66,7 +66,6 @@ class termsink(wx.Panel):
 		# This gets called in the queue runner thread context
 		# For now, just add whatever the user sends to the text control
 		text = msg.to_string()
-		print "handle_msg: received", len(text), "bytes"
 
 		# Create a wxPython event and post it to the event queue
 		evt = AppendEvent(text)
@@ -75,5 +74,4 @@ class termsink(wx.Panel):
 
         def evt_append(self, evt):
 		# This gets called by the wxPython event queue runner
-		print "appending", len(evt.text), "bytes"
 		self.text_ctrl.AppendText(evt.text)
-- 
cgit v1.2.3