From 92cfb0240005675f4e7a55a81552f4c7a5128cd8 Mon Sep 17 00:00:00 2001
From: Tim O'Shea <tim.oshea753@gmail.com>
Date: Wed, 28 Nov 2012 15:15:58 -0800
Subject: core: adding msg_connect, updating msg interface, adding symbolic
 block names

---
 grc/python/Connection.py   |  3 +++
 grc/python/Constants.py    |  1 +
 grc/python/Generator.py    |  4 +++-
 grc/python/flow_graph.tmpl | 11 +++++++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

(limited to 'grc')

diff --git a/grc/python/Connection.py b/grc/python/Connection.py
index 218baf0743..341dd2d821 100644
--- a/grc/python/Connection.py
+++ b/grc/python/Connection.py
@@ -31,6 +31,9 @@ class Connection(_Connection, _GUIConnection):
 	def is_msg(self):
 		return self.get_source().get_type() == self.get_sink().get_type() == 'msg'
 
+	def is_message(self):
+		return self.get_source().get_type() == self.get_sink().get_type() == 'message'
+
 	def validate(self):
 		"""
 		Validate the connections.
diff --git a/grc/python/Constants.py b/grc/python/Constants.py
index 1a65caf1c0..09c3081967 100644
--- a/grc/python/Constants.py
+++ b/grc/python/Constants.py
@@ -58,6 +58,7 @@ CORE_TYPES = ( #name, key, sizeof, color
 	('Integer 16', 's16', 2, '#FFFF66'),
 	('Integer 8', 's8', 1, '#FF66FF'),
 	('Message Queue', 'msg', 0, '#777777'),
+	('Async Message', 'message', 0, '#777777'),
 	('Wildcard', '', 0, '#FFFFFF'),
 )
 
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 2a6fe51d5d..616ea00fcb 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -116,8 +116,9 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
 		#list of regular blocks (all blocks minus the special ones)
 		blocks = filter(lambda b: b not in (imports + parameters), blocks)
 		#list of connections where each endpoint is enabled
-		connections = filter(lambda c: not c.is_msg(), self._flow_graph.get_enabled_connections())
+		connections = filter(lambda c: not (c.is_msg() or c.is_message()), self._flow_graph.get_enabled_connections())
 		messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections())
+		messages2 = filter(lambda c: c.is_message(), self._flow_graph.get_enabled_connections())
 		#list of variable names
 		var_ids = [var.get_id() for var in parameters + variables]
 		#prepend self.
@@ -142,6 +143,7 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
 			'blocks': blocks,
 			'connections': connections,
 			'messages': messages,
+			'messages2': messages2,
 			'generate_options': self._generate_options,
 			'var_id2cbs': var_id2cbs,
 		}
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 17feb01f65..af55ad641a 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -189,6 +189,17 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])
 		self.connect($make_port_sig($source), $make_port_sig($sink))
 	#end if
 #end for
+########################################################
+##Create Asynch Message Connections
+########################################################
+#if $messages2
+		$DIVIDER
+		# Asynch Message Connections
+		$DIVIDER
+#end if
+#for $msg in $messages2
+		self.msg_connect(self.$msg.get_source().get_parent().get_id(), "$msg.get_source().get_name()", self.$msg.get_sink().get_parent().get_id(), "$msg.get_sink().get_name()")
+#end for
 
 ########################################################
 ##Create Callbacks
-- 
cgit v1.2.3