summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
authorTim O'Shea <tim.oshea753@gmail.com>2012-11-28 15:15:58 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2012-11-28 15:19:01 -0800
commit7fc857a18cdc47f333db56cfedd2a4ed1a8432a9 (patch)
treeba1a6bf29ac4dbaae6ae68fd00067fd3ca53b44a /grc/python
parent12e279660e7300f42cbe993f89c8ad5ef6a3ea0a (diff)
core: adding msg_connect, updating msg interface, adding symbolic block names
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/Connection.py3
-rw-r--r--grc/python/Constants.py1
-rw-r--r--grc/python/Generator.py4
-rw-r--r--grc/python/flow_graph.tmpl11
4 files changed, 18 insertions, 1 deletions
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 f8490227a7..912ce13752 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -122,8 +122,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.
@@ -148,6 +149,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 6e504815a6..086c478c6a 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -192,6 +192,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
########################################################
# QT sink close method reimplementation